From 162262eb58c4642b7ffb9ed41bc760e0f009d6a6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 3 Aug 2018 12:38:18 +0300 Subject: replies counter in feeds reflect banned comments --- .../src/main/java/com/juick/server/CommandsManager.java | 14 +++++++------- .../src/main/java/com/juick/service/MessagesService.java | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'juick-common') diff --git a/juick-common/src/main/java/com/juick/server/CommandsManager.java b/juick-common/src/main/java/com/juick/server/CommandsManager.java index 7dd372b1..d3b85bef 100644 --- a/juick-common/src/main/java/com/juick/server/CommandsManager.java +++ b/juick-common/src/main/java/com/juick/server/CommandsManager.java @@ -198,7 +198,7 @@ public class CommandsManager { @UserCommand(pattern = "^#\\+$", help = "#+ - Show last Juick messages") public CommandResult commandLast(User user_from, URI attachment, String... arguments) { return CommandResult.fromString("Last messages:\n" - + printMessages(messagesService.getAll(user_from.getUid(), 0), true)); + + printMessages(user_from, messagesService.getAll(user_from.getUid(), 0), true)); } @UserCommand(pattern = "@", help = "@ - Show recommendations and popular personal blogs") @@ -279,7 +279,7 @@ public class CommandsManager { public CommandResult commandFavorites(User currentUser, URI attachment, String... args) { List mids = messagesService.getUserRecommendations(currentUser.getUid(), 0); if (mids.size() > 0) { - return CommandResult.fromString("Favorite messages: \n" + printMessages(mids, false)); + return CommandResult.fromString("Favorite messages: \n" + printMessages(currentUser, mids, false)); } return CommandResult.fromString("No favorite messages, try to \"like\" something ;)"); } @@ -393,7 +393,7 @@ public class CommandsManager { if (!blogUser.isAnonymous()) { List mids = messagesService.getUserBlog(blogUser.getUid(), 0, 0); return CommandResult.fromString(String.format("Last messages from @%s:\n%s", arguments[0], - printMessages(mids, false))); + printMessages(user, mids, false))); } return CommandResult.fromString("User not found"); } @@ -437,7 +437,7 @@ public class CommandsManager { if (tag != null) { // TODO: synonyms List mids = messagesService.getTag(tag.TID, user.getUid(), 0, 10); - return CommandResult.fromString("Last messages with *" + tag.getName() + ":\n" + printMessages(mids, true)); + return CommandResult.fromString("Last messages with *" + tag.getName() + ":\n" + printMessages(user, mids, true)); } return CommandResult.fromString("Tag not found"); } @@ -477,7 +477,7 @@ public class CommandsManager { int page = arguments[0].length() - 1; List mids = messagesService.getMyFeed(user.getUid(), page, false); if (mids.size() > 0) { - return CommandResult.fromString("Your feed: \n" + printMessages(mids, true)); + return CommandResult.fromString("Your feed: \n" + printMessages(user, mids, true)); } return CommandResult.fromString("Your feed is empty"); } @@ -523,8 +523,8 @@ public class CommandsManager { } } - String printMessages(List mids, boolean crop) { - return messagesService.getMessages(mids).stream() + String printMessages(User visitor, List mids, boolean crop) { + return messagesService.getMessages(visitor, mids).stream() .sorted(Collections.reverseOrder()) .map(PlainTextFormatter::formatPostSummary).collect(Collectors.joining("\n\n")); } diff --git a/juick-common/src/main/java/com/juick/service/MessagesService.java b/juick-common/src/main/java/com/juick/service/MessagesService.java index 8e69872a..28f59153 100644 --- a/juick-common/src/main/java/com/juick/service/MessagesService.java +++ b/juick-common/src/main/java/com/juick/service/MessagesService.java @@ -101,7 +101,7 @@ public interface MessagesService { List getUserSearch(int UID, String search, int privacy, int page); - List getMessages(List mids); + List getMessages(User visitor, List mids); Map> updateReactionsFor(final List mid); -- cgit v1.2.3