forked from matrix/element-web
Added all the notification states to the sub list count logic
This commit is contained in:
parent
ef9d6d45b6
commit
d3fa680373
|
@ -23,6 +23,7 @@ var sdk = require('matrix-react-sdk')
|
||||||
var dis = require('matrix-react-sdk/lib/dispatcher');
|
var dis = require('matrix-react-sdk/lib/dispatcher');
|
||||||
var Unread = require('matrix-react-sdk/lib/Unread');
|
var Unread = require('matrix-react-sdk/lib/Unread');
|
||||||
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
|
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
|
||||||
|
var RoomNotifs = require('matrix-react-sdk/lib/RoomNotifs');
|
||||||
|
|
||||||
// turn this on for drop & drag console debugging galore
|
// turn this on for drop & drag console debugging galore
|
||||||
var debug = false;
|
var debug = false;
|
||||||
|
@ -221,26 +222,21 @@ var RoomSubList = React.createClass({
|
||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
|
|
||||||
this.state.sortedList.map(function(room) {
|
this.state.sortedList.map(function(room) {
|
||||||
var notifsMuted = false;
|
var roomNotifState = RoomNotifs.getRoomNotifsState(room.roomId);
|
||||||
if (!cli.isGuest()) {
|
|
||||||
var roomPushRule = cli.getRoomPushRule("global", room.roomId);
|
|
||||||
if (roomPushRule) {
|
|
||||||
if (0 <= roomPushRule.actions.indexOf("dont_notify")) {
|
|
||||||
notifsMuted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var highlight = room.getUnreadNotificationCount('highlight') > 0 || self.props.label === 'Invites';
|
var highlight = room.getUnreadNotificationCount('highlight') > 0 || self.props.label === 'Invites';
|
||||||
|
|
||||||
var notificationCount = room.getUnreadNotificationCount();
|
var notificationCount = room.getUnreadNotificationCount();
|
||||||
|
|
||||||
if (notificationCount > 0 && (!notifsMuted || (notifsMuted && highlight))) {
|
if (notificationCount > 0 && roomNotifState !== RoomNotifs.MUTE) {
|
||||||
|
if (roomNotifState === RoomNotifs.ALL_MESSAGES_LOUD
|
||||||
|
|| roomNotifState === RoomNotifs.ALL_MESSAGES
|
||||||
|
|| (roomNotifState === RoomNotifs.MENTIONS_ONLY && highlight))
|
||||||
|
{
|
||||||
subListCount += notificationCount;
|
subListCount += notificationCount;
|
||||||
if (highlight) {
|
if (highlight) {
|
||||||
subListHighlight = true;
|
subListHighlight = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return [subListCount, subListHighlight];
|
return [subListCount, subListHighlight];
|
||||||
|
|
Loading…
Reference in New Issue