aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/controllers/Site.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-22 20:27:45 +0300
committerGravatar Vitaly Takmazov2023-01-22 20:57:06 +0300
commit478a7bfba88401c1996d0be5a144459011b60e10 (patch)
tree2bdbf40a9910c799673874d64a87a4ef0e5dc04b /src/main/java/com/juick/www/controllers/Site.java
parent9ad08dc78e0cdbe2cdebf10a96c800e72d48e48b (diff)
db refactoring: merge getMessages with isSubscribed query
Diffstat (limited to 'src/main/java/com/juick/www/controllers/Site.java')
-rw-r--r--src/main/java/com/juick/www/controllers/Site.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java
index bfe7d654..d0ea3dee 100644
--- a/src/main/java/com/juick/www/controllers/Site.java
+++ b/src/main/java/com/juick/www/controllers/Site.java
@@ -190,7 +190,7 @@ public class Site {
model.addAttribute("headers", head);
model.addAttribute("visitor", visitor);
model.addAttribute("noindex", !(paramShow == null && paramBefore == 0));
- List<Message> msgs = messagesService.getMessages(visitor, mids);
+ List<Message> msgs = messagesService.getMessages(visitor.getUid(), mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
fillUserModel(model, visitor, visitor);
@@ -301,7 +301,7 @@ public class Site {
model.addAttribute("noindex", paramShow == null && before == 0);
fillUserModel(model, user, visitor);
model.addAttribute("paramTag", paramTag);
- List<Message> msgs = messagesService.getMessages(visitor, mids);
+ List<Message> msgs = messagesService.getMessages(visitor.getUid(), mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
List<Integer> unread = messagesService.getUnread(visitor);
@@ -423,7 +423,7 @@ public class Site {
model.addAttribute("title", title);
List<Integer> mids = messagesService.getTag(paramTag.TID, visitor.getUid(), before,
(visitor.isAnonymous()) ? 40 : 20);
- List<Message> msgs = messagesService.getMessages(visitor, mids);
+ List<Message> msgs = messagesService.getMessages(visitor.getUid(), mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
List<Integer> unread = messagesService.getUnread(visitor);
@@ -504,7 +504,7 @@ public class Site {
throw new HttpForbiddenException();
}
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
- Optional<Message> message = messagesService.getMessage(mid);
+ Optional<Message> message = messagesService.getMessage(visitor.getUid(), mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
@@ -567,7 +567,6 @@ public class Site {
+ msg.getTags().stream().map(Tag::getName).collect(Collectors.joining(", ")) + "\" />\n";
}
model.addAttribute("headers", headers);
- model.addAttribute("visitorSubscribed", messagesService.isSubscribed(visitor.getUid(), msg.getMid()));
model.addAttribute("visitorInBL", userService.isInBL(msg.getUser().getUid(), visitor.getUid()));
List<Integer> blUIDs = new ArrayList<>();
for (Message reply : replies) {