Make toggle in settings revert between old behavior and new behavior for sorting by unreads

This commit is contained in:
Emi Simpson 2020-03-15 14:56:39 -04:00
parent abac4c8d34
commit bf5ae884de
No known key found for this signature in database
GPG key ID: 68FAB2E2E6DFC98B
3 changed files with 26 additions and 23 deletions

View file

@ -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;
}