From bf5ae884de25ee8cd31039de8f9d2d129f64ec66 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 14:56:39 -0400 Subject: Make toggle in settings revert between old behavior and new behavior for sorting by unreads --- src/RoomInfoListItem.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/RoomInfoListItem.cpp') diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index d7537d64..bac7ce51 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -329,29 +329,32 @@ RoomInfoListItem::updateUnreadMessageCount(int count, int highlightedCount) update(); } -enum NotificationImportance : unsigned short +enum NotificationImportance : short { - AllEventsRead = 0, - NewMinorEvents = 1, - NewMessage = 2, - NewMentions = 3, - Invite = 4 + ImportanceDisabled = -1, + AllEventsRead = 0, + NewMinorEvents = 1, // This is currently unused + NewMessage = 2, + NewMentions = 3, + Invite = 4 }; unsigned short int RoomInfoListItem::calculateImportance() const { // Returns the degree of importance of the unread messages in the room. - // If ignoreMinorEvents is set to true in the settings, then - // NewMinorEvents will always be rounded down to AllEventsRead - if (isInvite()) { + // If sorting by importance is disabled in settings, this only ever + // returns ImportanceDisabled + if (!settings->isSortByImportanceEnabled()) { + return ImportanceDisabled; + } else if (isInvite()) { return Invite; } else if (unreadHighlightedMsgCount_) { return NewMentions; } else if (unreadMsgCount_) { return NewMessage; - } else if (hasUnreadMessages_ && !settings->isIgnoreMinorEventsEnabled()) { - return NewMinorEvents; + // } else if (hasUnreadMessages_ && !settings->isIgnoreMinorEventsEnabled()) { + // return NewMinorEvents; } else { return AllEventsRead; } -- cgit 1.5.1