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

@ -138,7 +138,7 @@ const Notifier = {
let audioElement = selector; let audioElement = selector;
if (!selector) { if (!selector) {
if (!sound) { if (!sound) {
console.error("Tried to play alert sound but missing #messageAudio") console.error("Tried to play alert sound but missing #messageAudio");
return; return;
} }
audioElement = new Audio(sound.url); audioElement = new Audio(sound.url);
@ -150,7 +150,7 @@ const Notifier = {
audioElement.play(); audioElement.play();
}).catch((ex) => { }).catch((ex) => {
console.warn("Caught error when trying to fetch room notification sound:", ex); console.warn("Caught error when trying to fetch room notification sound:", ex);
}) });
}, },
start: function() { start: function() {

View file

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

View file

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