diff options
author | Vitaly Takmazov | 2018-05-08 23:50:47 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-05-08 23:50:47 +0300 |
commit | 41bdea7bc3b97cfb8e7366a4c50aee41407b223d (patch) | |
tree | dccd18ceb281b4aafa35609ba4d3df6da53b01f2 | |
parent | 6df778ed5299edc18bd65e2af8a5e0ae60b8191c (diff) |
api: add unread count to notifications
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/Notifications.java | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/Notifications.java b/juick-server/src/main/java/com/juick/server/api/Notifications.java index 94b66746..5c7cf7b9 100644 --- a/juick-server/src/main/java/com/juick/server/api/Notifications.java +++ b/juick-server/src/main/java/com/juick/server/api/Notifications.java @@ -59,6 +59,7 @@ public class Notifications { private User collectTokens(Integer uid) { User user = userService.getUserByUID(uid).orElse(AnonymousUser.INSTANCE); + user.setUnreadCount(messagesService.getUnread(user).size()); pushQueriesService.getGCMRegID(uid).forEach(t -> user.getTokens().add(new ExternalToken(null, "gcm", t, null))); pushQueriesService.getAPNSToken(uid).forEach(t -> user.getTokens().add(new ExternalToken(null, "apns", t, null))); pushQueriesService.getMPNSURL(uid).forEach(t -> user.getTokens().add(new ExternalToken(null, "mpns", t, null))); |