aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/server/www/controllers/MessagesWWW.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
index 50d90555..9ccd099b 100644
--- a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
+++ b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
@@ -156,7 +156,7 @@ public class MessagesWWW {
model.addAttribute("visitor", visitor);
model.addAttribute("noindex", !(paramShow == null && paramBefore == 0));
List<com.juick.Message> msgs = messagesService.getMessages(visitor, mids);
-
+ msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser())));
if (!visitor.isAnonymous()) {
fillUserModel(model, visitor, visitor);
List<Integer> unread = messagesService.getUnread(visitor);
@@ -164,7 +164,6 @@ public class MessagesWWW {
List<Integer> blUIDs = userService.checkBL(visitor.getUid(),
msgs.stream().map(m -> m.getUser().getUid()).collect(Collectors.toList()));
msgs.forEach(m -> {
- m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser()));
m.ReadOnly |= blUIDs.contains(m.getUser().getUid());
m.setUnread(unread.contains(m.getMid()));
});
@@ -276,14 +275,13 @@ public class MessagesWWW {
fillUserModel(model, user, visitor);
model.addAttribute("paramTag", paramTag);
List<com.juick.Message> msgs = messagesService.getMessages(visitor, mids);
-
+ msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser())));
if (!visitor.isAnonymous()) {
List<Integer> unread = messagesService.getUnread(visitor);
visitor.setUnreadCount(unread.size());
List<Integer> blUIDs = userService.checkBL(visitor.getUid(),
msgs.stream().map(m -> m.getUser().getUid()).collect(Collectors.toList()));
msgs.forEach(m -> {
- m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser()));
m.ReadOnly |= blUIDs.contains(m.getUser().getUid());
m.setUnread(unread.contains(m.getMid()));
});
@@ -415,6 +413,7 @@ public class MessagesWWW {
model.addAttribute("title", title);
List<Integer> mids = messagesService.getTag(paramTag.TID, visitor.getUid(), before, (visitor.isAnonymous()) ? 40 : 20);
List<com.juick.Message> msgs = messagesService.getMessages(visitor, mids);
+ msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser())));
if (!visitor.isAnonymous()) {
List<Integer> unread = messagesService.getUnread(visitor);
visitor.setUnreadCount(unread.size());
@@ -423,7 +422,6 @@ public class MessagesWWW {
msgs.stream().map(m -> m.getUser().getUid()).collect(Collectors.toList())
);
msgs.forEach(m -> {
- m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser()));
m.ReadOnly |= blUIDs.contains(m.getUser().getUid());
m.setUnread(unread.contains(m.getMid()));
});
@@ -524,6 +522,7 @@ public class MessagesWWW {
return String.format("redirect:/%s/%d", msg.getUser().getName(), mid);
}
msg.VisitorCanComment = !visitor.isAnonymous();
+ msg.getUser().setAvatar(webApp.getAvatarUrl(msg.getUser()));
List<com.juick.Message> replies = messagesService.getReplies(visitor, msg.getMid());
// this should be after getReplies to mark thread as read
fillUserModel(model, user, visitor);
@@ -532,7 +531,6 @@ public class MessagesWWW {
visitor.setUnreadCount(unread.size());
boolean isMsgAuthor = visitor.getUid() == msg.getUser().getUid();
boolean isInBL = userService.isInBLAny(msg.getUser().getUid(), visitor.getUid());
- msg.getUser().setAvatar(webApp.getAvatarUrl(msg.getUser()));
msg.VisitorCanComment = isMsgAuthor || !(msg.ReadOnly || isInBL);
}
model.addAttribute("msg", msg);
@@ -584,10 +582,10 @@ public class MessagesWWW {
blUIDs.add(reply.getUser().getUid());
}
reply.VisitorCanComment = !visitor.isAnonymous();
+ reply.getUser().setAvatar(webApp.getAvatarUrl(reply.getUser()));
if (!visitor.isAnonymous()) {
boolean isMsgAuthor = visitor.getUid() == msg.getUser().getUid();
boolean isReplyAuthor = visitor.getUid() == reply.getUser().getUid();
- reply.getUser().setAvatar(webApp.getAvatarUrl(reply.getUser()));
reply.VisitorCanComment = isMsgAuthor || (!msg.ReadOnly
&& msg.VisitorCanComment && (isReplyAuthor || !userService.isInBLAny(visitor.getUid(), reply.getUser().getUid())));
}