diff options
Diffstat (limited to 'juick-www/src')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/MessagesWWW.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/MessagesWWW.java b/juick-www/src/main/java/com/juick/www/controllers/MessagesWWW.java index 42bc5c49..01efd6c9 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/MessagesWWW.java +++ b/juick-www/src/main/java/com/juick/www/controllers/MessagesWWW.java @@ -19,6 +19,7 @@ package com.juick.www.controllers; import com.juick.Message; import com.juick.Tag; import com.juick.formatters.PlainTextFormatter; +import com.juick.server.component.MessageReadEvent; import com.juick.server.util.HttpForbiddenException; import com.juick.server.util.HttpNotFoundException; import com.juick.server.util.UserUtils; @@ -30,6 +31,7 @@ import org.apache.commons.codec.CharEncoding; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.text.StringEscapeUtils; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; @@ -65,6 +67,8 @@ public class MessagesWWW { private PMQueriesService pmQueriesService; @Inject private CrosspostService crosspostService; + @Inject + private ApplicationEventPublisher applicationEventPublisher; void fillUserModel(ModelMap model, com.juick.User user, com.juick.User visitor) { model.addAttribute("user", user); @@ -508,6 +512,9 @@ public class MessagesWWW { } msg.VisitorCanComment = visitor.getUid() > 0; List<com.juick.Message> replies = messagesService.getReplies(visitor, msg.getMid()); + if (!visitor.isAnonymous()) { + applicationEventPublisher.publishEvent(new MessageReadEvent(this, visitor, msg)); + } // this should be after getReplies to mark thread as read fillUserModel(model, user, visitor); if (visitor.getUid() > 0) { |