From aa2a16145a084290cae1b4c8934a19abfbd7ac5d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 23 Oct 2018 21:05:41 +0300 Subject: update last_seen on message read --- juick-server/src/main/java/com/juick/server/TelegramBotManager.java | 1 + juick-server/src/main/java/com/juick/server/api/Messages.java | 2 ++ 2 files changed, 3 insertions(+) (limited to 'juick-server/src/main/java/com') diff --git a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java index 01dd7b66..c946d7c9 100644 --- a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java +++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java @@ -312,6 +312,7 @@ public class TelegramBotManager implements NotificationListener { messagesService.setLastReadComment(userService.getUserByUID(userId) .orElseThrow(IllegalStateException::new), source.getMid(), source.getRid()); User user = userService.getUserByUID(userId).orElseThrow(IllegalStateException::new); + userService.updateLastSeen(user); applicationEventPublisher.publishEvent( new MessageReadEvent(this, user, source)); } diff --git a/juick-server/src/main/java/com/juick/server/api/Messages.java b/juick-server/src/main/java/com/juick/server/api/Messages.java index 424ea492..4f0009dd 100644 --- a/juick-server/src/main/java/com/juick/server/api/Messages.java +++ b/juick-server/src/main/java/com/juick/server/api/Messages.java @@ -174,6 +174,7 @@ public class Messages { msg.setRecommendations(new HashSet<>(messagesService.getMessageRecommendations(msg.getMid()))); List replies = messagesService.getReplies(visitor, mid); if (!visitor.isAnonymous()) { + userService.updateLastSeen(visitor); applicationEventPublisher.publishEvent( new MessageReadEvent(this, visitor, msg)); } @@ -189,6 +190,7 @@ public class Messages { if (!visitor.isAnonymous()) { messagesService.setLastReadComment(visitor, mid, rid); Message msg = messagesService.getMessage(mid); + userService.updateLastSeen(visitor); applicationEventPublisher.publishEvent( new MessageReadEvent(this, visitor, msg)); return IOUtils.toByteArray( -- cgit v1.2.3