aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-23 21:05:41 +0300
committerGravatar Vitaly Takmazov2018-10-23 21:05:41 +0300
commitaa2a16145a084290cae1b4c8934a19abfbd7ac5d (patch)
treefcc8e3bd7fbf0d3b182694b975ebe55dfc28cbfd
parent8e83a22012c2bee323eeeb3ae1384ac488741ebf (diff)
update last_seen on message read
-rw-r--r--juick-server/src/main/java/com/juick/server/TelegramBotManager.java1
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Messages.java2
2 files changed, 3 insertions, 0 deletions
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<com.juick.Message> 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(