diff --git a/src/components/views/rooms/NotificationStateContextMenu.js b/src/components/views/rooms/NotificationStateContextMenu.js index d485422d..3d125d2c 100644 --- a/src/components/views/rooms/NotificationStateContextMenu.js +++ b/src/components/views/rooms/NotificationStateContextMenu.js @@ -46,22 +46,6 @@ module.exports = React.createClass({ }; }, - onAllClick: function() { - if (this.props.onFinished) { - this.setState({areNotifsMuted: false}); - this._save(false); - this.props.onFinished(); - } - }, - - onMuteClick: function() { - if (this.props.onFinished) { - this.setState({areNotifsMuted: true}); - this._save(true); - this.props.onFinished(); - } - }, - _save: function( isMuted ) { const roomId = this.props.room.roomId; /* @@ -71,35 +55,43 @@ module.exports = React.createClass({ )); } */ - MatrixClientPeg.get().setRoomMutePushRule( - "global", roomId, isMuted - ); + var cli = MatrixClientPeg.get(); + this.setState({areNotifsMuted: isMuted}); + if (!cli.isGuest()) { + cli.setRoomMutePushRule( + "global", roomId, isMuted + ); + } }, - _onToggle: function(keyName, checkedValue, uncheckedValue, ev) { - console.log("Checkbox toggle: %s %s", keyName, ev.target.checked); - var state = {}; - state[keyName] = ev.target.checked ? checkedValue : uncheckedValue; - this.setState(state); + _onToggle: function(ev) { + switch (ev.target.value) { + case "all": + if (this.props.onFinished) { + this._save(false); + this.props.onFinished(); + } + break; + case "mute": + if (this.props.onFinished) { + this._save(true); + this.props.onFinished(); + } + break; + } }, render: function() { var cli = MatrixClientPeg.get(); return (