This commit is contained in:
Will Hunt 2019-04-19 21:42:18 +01:00
parent 63ab7736ca
commit d33df45c5e
3 changed files with 10 additions and 15 deletions

View file

@ -120,7 +120,7 @@ const Notifier = {
console.warn(`${room.roomId} has custom notification sound event, but no url key`);
return null;
}
return {
url: MatrixClientPeg.get().mxcUrlToHttp(content.url),
name: content.name,
@ -138,7 +138,7 @@ const Notifier = {
let audioElement = selector;
if (!selector) {
if (!sound) {
console.error("Tried to play alert sound but missing #messageAudio")
console.error("Tried to play alert sound but missing #messageAudio");
return;
}
audioElement = new Audio(sound.url);
@ -150,7 +150,7 @@ const Notifier = {
audioElement.play();
}).catch((ex) => {
console.warn("Caught error when trying to fetch room notification sound:", ex);
})
});
},
start: function() {

View file

@ -23,7 +23,7 @@ import RolesRoomSettingsTab from "../settings/tabs/room/RolesRoomSettingsTab";
import GeneralRoomSettingsTab from "../settings/tabs/room/GeneralRoomSettingsTab";
import SecurityRoomSettingsTab from "../settings/tabs/room/SecurityRoomSettingsTab";
import NotificationSettingsTab from "../settings/tabs/room/NotificationSettingsTab";
import sdk from "../../../index";RolesRoomSettingsTab
import sdk from "../../../index";
import MatrixClientPeg from "../../../MatrixClientPeg";
export default class RoomSettingsDialog extends React.Component {
@ -54,7 +54,7 @@ export default class RoomSettingsDialog extends React.Component {
_td("Notifications"),
"mx_RoomSettingsDialog_rolesIcon",
<NotificationSettingsTab roomId={this.props.roomId} />,
))
));
tabs.push(new Tab(
_td("Advanced"),
"mx_RoomSettingsDialog_warningIcon",

View file

@ -18,10 +18,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import {_t} from "../../../../../languageHandler";
import MatrixClientPeg from "../../../../../MatrixClientPeg";
import sdk from "../../../../..";
import AccessibleButton from "../../../elements/AccessibleButton";
import Modal from "../../../../../Modal";
import dis from "../../../../../dispatcher";
import Notifier from "../../../../../Notifier";
export default class NotificationsSettingsTab extends React.Component {
@ -45,8 +42,8 @@ export default class NotificationsSettingsTab extends React.Component {
if (!soundData) {
return;
}
this.setState({currentSound: soundData.name || soundData.url})
})
this.setState({currentSound: soundData.name || soundData.url});
});
}
_onSoundUploadChanged(e) {
@ -63,7 +60,7 @@ export default class NotificationsSettingsTab extends React.Component {
});
}
async _saveSound (e) {
async _saveSound(e) {
e.stopPropagation();
e.preventDefault();
if (!this.state.uploadedFile) {
@ -98,10 +95,10 @@ export default class NotificationsSettingsTab extends React.Component {
});
}
_clearSound (e) {
_clearSound(e) {
e.stopPropagation();
e.preventDefault();
const room = client.getRoom(this.props.roomId);
const room = MatrixClientPeg.get().getRoom(this.props.roomId);
Notifier.clearRoomSound(room);
this.setState({
@ -110,8 +107,6 @@ export default class NotificationsSettingsTab extends React.Component {
}
render() {
const client = MatrixClientPeg.get();
return (
<div className="mx_SettingsTab">
<div className="mx_SettingsTab_heading">{_t("Notifications")}</div>