Skip to content

Commit 6b0aeef

Browse files
committed
RoomNotifs.js moved to react-sdk
Since it's now used in RoomTile. Remove the vector prefix since it's no longer really a 'vector' thing
1 parent cd0ed87 commit 6b0aeef

2 files changed

Lines changed: 10 additions & 156 deletions

File tree

‎src/components/views/context_menus/NotificationStateContextMenu.js‎

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ limitations under the License.
1919
var q = require("q");
2020
var React = require('react');
2121
var classNames = require('classnames');
22+
var RoomNotifs = require('matrix-react-sdk/lib/RoomNotifs');
2223
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
23-
var dis = require('matrix-react-sdk/lib/dispatcher');
24-
var RoomNotifs = require('../../../notifications/RoomNotifs');
2524

2625
module.exports = React.createClass({
2726
displayName: 'NotificationStateContextMenu',
@@ -34,33 +33,25 @@ module.exports = React.createClass({
3433

3534
getInitialState() {
3635
return {
37-
vectorRoomNotifState: RoomNotifs.getVectorRoomNotifsState(this.props.room.roomId),
36+
roomNotifState: RoomNotifs.getRoomNotifsState(this.props.room.roomId),
3837
}
3938
},
4039

4140
_save: function(newState) {
42-
const oldState = this.state.vectorRoomNotifState;
41+
const oldState = this.state.roomNotifState;
4342
const roomId = this.props.room.roomId;
4443
var cli = MatrixClientPeg.get();
4544

4645
if (!cli.isGuest()) {
4746
// Wrapping this in a q promise, as setRoomMutePushRule can return
4847
// a promise or a value
4948
this.setState({
50-
vectorRoomNotifState: newState,
49+
roomNotifState: newState,
5150
});
52-
RoomNotifs.setVectorRoomNotifsState(this.props.room.roomId, newState).done(() => {
51+
RoomNotifs.setRoomNotifsState(this.props.room.roomId, newState).done(() => {
5352
// delay slightly so that the user can see their state change
5453
// before closing the menu
5554
return q.delay(500).then(() => {
56-
// tell everyone that wants to know of the change in
57-
// notification state
58-
dis.dispatch({
59-
action: 'notification_change',
60-
roomId: this.props.room.roomId,
61-
//areNotifsMuted: areNotifsMuted,
62-
});
63-
6455
// Close the context menu
6556
if (this.props.onFinished) {
6657
this.props.onFinished();
@@ -71,7 +62,7 @@ module.exports = React.createClass({
7162
// to inform them that their state change failed.
7263
// For now we at least set the state back
7364
this.setState({
74-
vectorRoomNotifState: oldState,
65+
roomNotifState: oldState,
7566
});
7667
});
7768
}
@@ -96,22 +87,22 @@ module.exports = React.createClass({
9687
render: function() {
9788
var alertMeClasses = classNames({
9889
'mx_NotificationStateContextMenu_field': true,
99-
'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'all_messages_loud',
90+
'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'all_messages_loud',
10091
});
10192

10293
var allNotifsClasses = classNames({
10394
'mx_NotificationStateContextMenu_field': true,
104-
'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'all_messages',
95+
'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'all_messages',
10596
});
10697

10798
var mentionsClasses = classNames({
10899
'mx_NotificationStateContextMenu_field': true,
109-
'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'mentions_only',
100+
'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'mentions_only',
110101
});
111102

112103
var muteNotifsClasses = classNames({
113104
'mx_NotificationStateContextMenu_field': true,
114-
'mx_NotificationStateContextMenu_fieldSet': this.state.vectorRoomNotifState == 'mute',
105+
'mx_NotificationStateContextMenu_fieldSet': this.state.roomNotifState == 'mute',
115106
});
116107

117108
return (

‎src/notifications/RoomNotifs.js‎

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)