aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp14
-rw-r--r--lib/syncdata.cpp8
2 files changed, 14 insertions, 8 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index b461b0a1..77abf04c 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1561,11 +1561,21 @@ void Room::updateData(SyncRoomData&& data, bool fromCache)
emit unreadMessagesChanged(this);
}
- if (data.highlightCount != d->highlightCount) {
+ // Similar to unreadCount, SyncRoomData constructor assigns -1 to
+ // highlightCount/notificationCount when those are missing in the payload
+ if (data.highlightCount != -1 && data.highlightCount != d->highlightCount) {
+ qCDebug(MESSAGES).nospace()
+ << "Highlights in " << objectName() //
+ << ": " << d->highlightCount << " -> " << data.highlightCount;
d->highlightCount = data.highlightCount;
emit highlightCountChanged();
}
- if (data.notificationCount != d->notificationCount) {
+ if (data.notificationCount != -1
+ && data.notificationCount != d->notificationCount) //
+ {
+ qCDebug(MESSAGES).nospace()
+ << "Notifications in " << objectName() //
+ << ": " << d->notificationCount << " -> " << data.notificationCount;
d->notificationCount = data.notificationCount;
emit notificationCountChanged();
}
diff --git a/lib/syncdata.cpp b/lib/syncdata.cpp
index 64aa65fd..70c4a15f 100644
--- a/lib/syncdata.cpp
+++ b/lib/syncdata.cpp
@@ -106,12 +106,8 @@ SyncRoomData::SyncRoomData(const QString& roomId_, JoinState joinState_,
const auto unreadJson = room_.value("unread_notifications"_ls).toObject();
unreadCount = unreadJson.value(UnreadCountKey).toInt(-2);
- highlightCount = unreadJson.value("highlight_count"_ls).toInt();
- notificationCount = unreadJson.value("notification_count"_ls).toInt();
- if (highlightCount > 0 || notificationCount > 0)
- qCDebug(SYNCJOB) << "Room" << roomId_
- << "has highlights:" << highlightCount
- << "and notifications:" << notificationCount;
+ highlightCount = unreadJson.value("highlight_count"_ls).toInt(-1);
+ notificationCount = unreadJson.value("notification_count"_ls).toInt(-1);
}
SyncData::SyncData(const QString& cacheFileName)