diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-25 11:10:52 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-25 13:23:40 +0900 |
commit | 52aadc68d73d7e590ab7ec3f8b4382483a50bcf1 (patch) | |
tree | f19af82f8f3e828aa810e2f7aab52e2ac8fca670 | |
parent | b4e699a0076fc7827fa89af33d8774d43eb017ce (diff) | |
download | libquotient-52aadc68d73d7e590ab7ec3f8b4382483a50bcf1.tar.gz libquotient-52aadc68d73d7e590ab7ec3f8b4382483a50bcf1.zip |
Room::Private::toJson: don't save zero numbers
-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; } |