From 478a7bfba88401c1996d0be5a144459011b60e10 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 22 Jan 2023 20:27:45 +0300 Subject: db refactoring: merge getMessages with isSubscribed query --- src/main/java/com/juick/www/api/Mastodon.java | 2 +- src/main/java/com/juick/www/api/Messages.java | 6 +++--- src/main/java/com/juick/www/api/activity/Profile.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/juick/www/api') diff --git a/src/main/java/com/juick/www/api/Mastodon.java b/src/main/java/com/juick/www/api/Mastodon.java index a190defe..91de2162 100644 --- a/src/main/java/com/juick/www/api/Mastodon.java +++ b/src/main/java/com/juick/www/api/Mastodon.java @@ -353,7 +353,7 @@ public class Mastodon { } else if (timeline.equals("home")) { mids = messagesService.getMyFeed(visitor.getUid(), before, true); } - return messagesService.getMessages(visitor, mids).stream() + return messagesService.getMessages(visitor.getUid(), mids).stream() .map(m -> { m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser())); return toStatus(m); diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java index fb10d7a7..ecdd304f 100644 --- a/src/main/java/com/juick/www/api/Messages.java +++ b/src/main/java/com/juick/www/api/Messages.java @@ -73,7 +73,7 @@ public class Messages { @RequestParam(defaultValue = "0") int before_mid) { int vuid = visitor.getUid(); List mids = messagesService.getMyFeed(vuid, before_mid, true); - List msgs = messagesService.getMessages(visitor, mids); + List msgs = messagesService.getMessages(vuid, mids); msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser()))); return msgs; } @@ -131,7 +131,7 @@ public class Messages { mids = messagesService.getAll(visitor.getUid(), before); } } - List msgs = messagesService.getMessages(visitor, mids); + List msgs = messagesService.getMessages(visitor.getUid(), mids); msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser()))); return msgs; } @@ -153,7 +153,7 @@ public class Messages { @GetMapping("/api/messages/discussions") public List getDiscussions(@Parameter(hidden = true) User visitor, @RequestParam(required = false, defaultValue = "0") Long to) { - List msgs = messagesService.getMessages(visitor, messagesService.getDiscussions(visitor.getUid(), to)); + List msgs = messagesService.getMessages(visitor.getUid(), messagesService.getDiscussions(visitor.getUid(), to)); msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser()))); return msgs; } diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java index 7b440a6a..580ed340 100644 --- a/src/main/java/com/juick/www/api/activity/Profile.java +++ b/src/main/java/com/juick/www/api/activity/Profile.java @@ -141,7 +141,7 @@ public class Profile { UriComponentsBuilder uri = UriComponentsBuilder.fromUriString(baseUri); String personUri = uri.path(String.format("/u/%s", userName)).toUriString(); List mids = messagesService.getUserBlog(user.getUid(), 0, before); - List notes = messagesService.getMessages(visitor, mids).stream().map(activityPubManager::makeNote) + List notes = messagesService.getMessages(visitor.getUid(), mids).stream().map(activityPubManager::makeNote) .toList(); OrderedCollectionPage page = new OrderedCollectionPage(); page.setPartOf(uri.replacePath(String.format("/u/%s/blog/toc", userName)).toUriString()); -- cgit v1.2.3