diff options
-rw-r--r-- | room.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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; } |