aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-01 00:09:52 +0300
committerGravatar Vitaly Takmazov2018-07-01 00:09:52 +0300
commit0963fd937d119eaa5f8aa5174e5de3eb6c990007 (patch)
tree8c517c112fd5f82f9728635609294097fba1d824 /juick-server
parentdd5cc385090a295260ecde438f405a876f829033 (diff)
Api: unread count in /me
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Users.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/Users.java b/juick-server/src/main/java/com/juick/server/api/Users.java
index 4e447d04..a7ea7ea0 100644
--- a/juick-server/src/main/java/com/juick/server/api/Users.java
+++ b/juick-server/src/main/java/com/juick/server/api/Users.java
@@ -20,6 +20,7 @@ package com.juick.server.api;
import com.juick.User;
import com.juick.server.util.HttpForbiddenException;
import com.juick.server.util.HttpNotFoundException;
+import com.juick.service.MessagesService;
import com.juick.service.UserService;
import com.juick.server.util.UserUtils;
import com.juick.server.util.WebUtils;
@@ -39,6 +40,8 @@ import java.util.List;
public class Users {
@Inject
private UserService userService;
+ @Inject
+ private MessagesService messagesService;
@ApiOperation(value = "This returns user token", notes = "Pass login and password using HTTP Basic")
@RequestMapping(value = "/auth", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@@ -74,6 +77,7 @@ public class Users {
me.setUid(visitor.getUid());
me.setName(visitor.getName());
me.setAuthHash(getAuthToken());
+ me.setUnreadCount(messagesService.getUnread(visitor).size());
return me;
}