aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-05-08 23:50:47 +0300
committerGravatar Vitaly Takmazov2018-05-08 23:50:47 +0300
commit41bdea7bc3b97cfb8e7366a4c50aee41407b223d (patch)
treedccd18ceb281b4aafa35609ba4d3df6da53b01f2 /juick-server/src/main/java
parent6df778ed5299edc18bd65e2af8a5e0ae60b8191c (diff)
api: add unread count to notifications
Diffstat (limited to 'juick-server/src/main/java')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Notifications.java1
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)));