diff --git a/src/RoomNotifs.js b/src/RoomNotifs.js index 39384b5bea..5690817da5 100644 --- a/src/RoomNotifs.js +++ b/src/RoomNotifs.js @@ -26,12 +26,12 @@ export const MUTE = 'mute'; export const BADGE_STATES = [ALL_MESSAGES, ALL_MESSAGES_LOUD]; export const MENTION_BADGE_STATES = [...BADGE_STATES, MENTIONS_ONLY]; -function _shouldShowNotifBadge(roomNotifState) { +export function shouldShowNotifBadge(roomNotifState) { const showBadgeInStates = [ALL_MESSAGES, ALL_MESSAGES_LOUD]; return showBadgeInStates.indexOf(roomNotifState) > -1; } -function _shouldShowMentionBadge(roomNotifState) { +export function shouldShowMentionBadge(roomNotifState) { return roomNotifState !== MUTE; } @@ -41,8 +41,8 @@ export function aggregateNotificationCount(rooms) { const highlight = room.getUnreadNotificationCount('highlight') > 0; const notificationCount = room.getUnreadNotificationCount(); - const notifBadges = notificationCount > 0 && _shouldShowNotifBadge(roomNotifState); - const mentionBadges = highlight && _shouldShowMentionBadge(roomNotifState); + const notifBadges = notificationCount > 0 && shouldShowNotifBadge(roomNotifState); + const mentionBadges = highlight && shouldShowMentionBadge(roomNotifState); const badges = notifBadges || mentionBadges; if (badges) { @@ -60,8 +60,8 @@ export function getRoomHasBadge(room) { const highlight = room.getUnreadNotificationCount('highlight') > 0; const notificationCount = room.getUnreadNotificationCount(); - const notifBadges = notificationCount > 0 && _shouldShowNotifBadge(roomNotifState); - const mentionBadges = highlight && _shouldShowMentionBadge(roomNotifState); + const notifBadges = notificationCount > 0 && shouldShowNotifBadge(roomNotifState); + const mentionBadges = highlight && shouldShowMentionBadge(roomNotifState); return notifBadges || mentionBadges; } diff --git a/src/components/views/rooms/RoomTile.js b/src/components/views/rooms/RoomTile.js index e1b9567ebd..c4bd2adf2c 100644 --- a/src/components/views/rooms/RoomTile.js +++ b/src/components/views/rooms/RoomTile.js @@ -67,14 +67,6 @@ module.exports = React.createClass({ }); }, - _shouldShowNotifBadge: function() { - return RoomNotifs.BADGE_STATES.includes(this.state.notifState); - }, - - _shouldShowMentionBadge: function() { - return RoomNotifs.MENTION_BADGE_STATES.includes(this.state.notifState); - }, - _isDirectMessageRoom: function(roomId) { const dmRooms = DMRoomMap.shared().getUserIdForRoomId(roomId); return Boolean(dmRooms); @@ -301,8 +293,8 @@ module.exports = React.createClass({ const notificationCount = this.props.notificationCount; // var highlightCount = this.props.room.getUnreadNotificationCount("highlight"); - const notifBadges = notificationCount > 0 && this._shouldShowNotifBadge(); - const mentionBadges = this.props.highlight && this._shouldShowMentionBadge(); + const notifBadges = notificationCount > 0 && RoomNotifs.shouldShowNotifBadge(this.state.notifState); + const mentionBadges = this.props.highlight && RoomNotifs.shouldShowMentionBadge(this.state.notifState); const badges = notifBadges || mentionBadges; let subtext = null;