aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-12 11:27:54 +0300
committerGravatar Vitaly Takmazov2018-04-12 11:27:54 +0300
commit7be6ec73812f86bf09ff03e2b076ec6acd15eba4 (patch)
treeba5698e5c9b5d810a17598214dc2e62b365a3803 /juick-www/src
parent2048543036133fd2a563664fd6d6346e4e49ebe5 (diff)
www: fix unread template
Diffstat (limited to 'juick-www/src')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/MessagesWWW.java2
-rw-r--r--juick-www/src/main/resources/templates/views/partial/navigation.html2
2 files changed, 2 insertions, 2 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 e840b767..ecd60a52 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
@@ -67,6 +67,7 @@ public class MessagesWWW {
private CrosspostService crosspostService;
void fillUserModel(ModelMap model, com.juick.User user, com.juick.User visitor) {
+ user.setUnreadCount(messagesService.getUnread(visitor).size());
model.addAttribute("user", user);
model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid()));
model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid()));
@@ -79,7 +80,6 @@ public class MessagesWWW {
model.addAttribute("iread", userService.getUserReadLeastPopular(user.getUid(), 8));
model.addAttribute("tagStats", tagService.getUserTagStats(user.getUid())
.stream().sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).limit(20).map(t -> t.getTag().getName()).collect(Collectors.toList()));
- model.addAttribute("unread", messagesService.getUnread(visitor));
}
@GetMapping("/")
diff --git a/juick-www/src/main/resources/templates/views/partial/navigation.html b/juick-www/src/main/resources/templates/views/partial/navigation.html
index 4e3a6ae3..fa1dadcc 100644
--- a/juick-www/src/main/resources/templates/views/partial/navigation.html
+++ b/juick-www/src/main/resources/templates/views/partial/navigation.html
@@ -18,7 +18,7 @@
<nav id="global">
<ul>
{% if visitor.uid > 0 %}
- <li><a href="/?show=discuss"><i data-icon="ei-comment" data-size="s"></i>{{ i18n("messages","link.discuss") }}{% if unread > 0 %}<span class="badge">{{ unread }}</span>{% endif %}</a></li>
+ <li><a href="/?show=discuss"><i data-icon="ei-comment" data-size="s"></i>{{ i18n("messages","link.discuss") }}{% if visitor.unreadCount > 0 %}<span class="badge">{{ visitor.unreadCount }}</span>{% endif %}</a></li>
{% else %}
<li><a href="/?show=photos" rel="nofollow"><i data-icon="ei-camera" data-size="s"></i>{{ i18n("messages","link.withPhotos") }}</a></li>
{% endif %}