aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--room.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/room.cpp b/room.cpp
index ab7f7a8f..e3e0fb47 100644
--- a/room.cpp
+++ b/room.cpp
@@ -1499,9 +1499,12 @@ QJsonObject Room::Private::toJson() const
}
QJsonObject unreadNotificationsObj;
- unreadNotificationsObj.insert("highlight_count", highlightCount);
- unreadNotificationsObj.insert("notification_count", notificationCount);
- result.insert("unread_notifications", unreadNotificationsObj);
+ if (highlightCount > 0)
+ unreadNotificationsObj.insert("highlight_count", highlightCount);
+ if (notificationCount > 0)
+ unreadNotificationsObj.insert("notification_count", notificationCount);
+ if (!unreadNotificationsObj.isEmpty())
+ result.insert("unread_notifications", unreadNotificationsObj);
return result;
}