From 516b3cf0032a6204711dc85cd42d2bf41b84e999 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 16 Apr 2018 22:05:31 +0300 Subject: www: fix refreshing notifications counter --- juick-www/src/main/java/com/juick/www/controllers/MessagesWWW.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'juick-www/src/main/java/com/juick') 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 3c3c5d43..78474f49 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 @@ -507,9 +507,12 @@ public class MessagesWWW { return String.format("redirect:/%s/%d", msg.getUser().getName(), mid); } msg.VisitorCanComment = visitor.getUid() > 0; + List replies = messagesService.getReplies(visitor, msg.getMid()); if (visitor.getUid() > 0) { List unread = messagesService.getUnread(visitor); visitor.setUnreadCount(unread.size()); + // this should be after getReplies to mark thread as read + fillUserModel(model, user, visitor); boolean isMsgAuthor = visitor.getUid() == msg.getUser().getUid(); boolean isInBL = userService.isInBLAny(msg.getUser().getUid(), visitor.getUid()); msg.VisitorCanComment = isMsgAuthor || !(msg.ReadOnly || isInBL); @@ -556,9 +559,6 @@ public class MessagesWWW { model.addAttribute("visitorSubscribed", messagesService.isSubscribed(visitor.getUid(), msg.getMid())); model.addAttribute("visitorInBL", userService.isInBL(msg.getUser().getUid(), visitor.getUid())); model.addAttribute("recomm", messagesService.getMessageRecommendations(msg.getMid())); - List replies = messagesService.getReplies(visitor, msg.getMid()); - // this should be after getReplies to mark thread as read - fillUserModel(model, user, visitor); List blUIDs = new ArrayList<>(); for (Message reply : replies) { if (reply.getUser().getUid() != msg.getUser().getUid() -- cgit v1.2.3