diff options
author | Emi Simpson <emi@alchemi.dev> | 2020-03-15 14:56:39 -0400 |
---|---|---|
committer | Emi Simpson <emi@alchemi.dev> | 2020-03-15 14:56:39 -0400 |
commit | bf5ae884de25ee8cd31039de8f9d2d129f64ec66 (patch) | |
tree | 6f4b51a4924110261b17425077913a9be7ac52b7 /src/RoomInfoListItem.cpp | |
parent | Sort room list on setting change (diff) | |
download | nheko-bf5ae884de25ee8cd31039de8f9d2d129f64ec66.tar.xz |
Make toggle in settings revert between old behavior and new behavior for sorting by unreads
Diffstat (limited to 'src/RoomInfoListItem.cpp')
-rw-r--r-- | src/RoomInfoListItem.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
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; } |