Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 668d03e

Browse files
committed
fix linter errors
Signed-off-by: Florian Schunk <florian.schunk@karrieretutor.de>
1 parent 4d055e0 commit 668d03e

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/components/views/settings/tabs/room/NotificationSettingsTab.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import PropTypes from 'prop-types';
1919
import {_t} from "../../../../../languageHandler";
2020
import {MatrixClientPeg} from "../../../../../MatrixClientPeg";
2121
import AccessibleButton from "../../../elements/AccessibleButton";
22-
import Notifier from "../../../../../Notifier";
2322
import SettingsStore from '../../../../../settings/SettingsStore';
2423
import {SettingLevel} from "../../../../../settings/SettingLevel";
2524
import {replaceableComponent} from "../../../../../utils/replaceableComponent";
@@ -53,9 +52,9 @@ export default class NotificationsSettingsTab extends React.Component {
5352
console.log(soundLibrary);
5453
const selected = (soundData === null) ? "default" : soundData.name;
5554
this.setState({
56-
currentSound: soundData.name || soundData.url,
57-
selected: selected,
58-
soundLibrary: soundLibrary,
55+
currentSound: soundData.name || soundData.url,
56+
selected: selected,
57+
soundLibrary: soundLibrary,
5958
});
6059
}
6160

@@ -69,7 +68,7 @@ export default class NotificationsSettingsTab extends React.Component {
6968
}
7069

7170
const file = e.target.files[0];
72-
let soundLibrary = this.state.soundLibrary;
71+
const soundLibrary = this.state.soundLibrary;
7372

7473
if (file.name in soundLibrary) {
7574
const QuestionDialog = sdk.getComponent('dialogs.QuestionDialog');
@@ -87,12 +86,11 @@ export default class NotificationsSettingsTab extends React.Component {
8786
return;
8887
}
8988
this._uploadSound(file);
90-
9189
}
9290

9391
async _uploadSound(file) {
94-
9592
let type = file.type;
93+
9694
if (type === "video/ogg") {
9795
// XXX: I've observed browsers allowing users to pick a audio/ogg files,
9896
// and then calling it a video/ogg. This is a lame hack, but man browsers
@@ -113,7 +111,7 @@ export default class NotificationsSettingsTab extends React.Component {
113111
url,
114112
};
115113

116-
let soundLibrary = this.state.soundLibrary;
114+
const soundLibrary = this.state.soundLibrary;
117115
soundLibrary[soundJSON.name] = soundJSON;
118116

119117
await SettingsStore.setValue(
@@ -125,9 +123,8 @@ export default class NotificationsSettingsTab extends React.Component {
125123

126124
this.setState({
127125
soundLibrary: soundLibrary,
128-
selected: soundJSON.name,
126+
selected: soundJSON.name,
129127
});
130-
131128
}
132129

133130
async _onClickSaveSound(e) {
@@ -203,8 +200,9 @@ export default class NotificationsSettingsTab extends React.Component {
203200

204201

205202
render() {
206-
207203
const notChanged = this.state.currentSound == this.state.selected && !this.state.currentSoundReplaced;
204+
const soundOptions = Object.keys(this.state.soundLibrary)
205+
.map((sound, i) => <option key={i} value={sound}>{sound}</option>);
208206

209207
return (
210208
<div className="mx_SettingsTab">
@@ -224,11 +222,17 @@ export default class NotificationsSettingsTab extends React.Component {
224222
onChange={this._onChangeSelection.bind(this)}
225223
>
226224
<option key="default" value="default">{_t("Default")}</option>
227-
{Object.keys(this.state.soundLibrary).map((sound, i) => <option key={i} value={sound}>{sound}</option>)}
225+
{soundOptions}
228226
<option key="uplod" value="upload">{_t("upload")}</option>
229227
</Field>
230228
<form autoComplete="off" noValidate={true}>
231-
<input ref={this._soundUpload} className="mx_NotificationSound_soundUpload" type="file" onChange={this._onSoundUploadChanged.bind(this)} accept="audio/*" />
229+
<input
230+
ref={this._soundUpload}
231+
className="mx_NotificationSound_soundUpload"
232+
type="file"
233+
onChange={this._onSoundUploadChanged.bind(this)}
234+
accept="audio/*"
235+
/>
232236
</form>
233237

234238
<AccessibleButton className="mx_NotificationSound_resetSound" disabled={notChanged} onClick={this._onReset.bind(this)} kind="primary">

0 commit comments

Comments
 (0)