diff options
Diffstat (limited to 'juick-common/src/main/java/com/juick/server')
-rw-r--r-- | juick-common/src/main/java/com/juick/server/CommandsManager.java | 14 |
1 files changed, 7 insertions, 7 deletions
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 7dd372b1d..d3b85bef4 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> mids, boolean crop) { - return messagesService.getMessages(mids).stream() + String printMessages(User visitor, List<Integer> mids, boolean crop) { + return messagesService.getMessages(visitor, mids).stream() .sorted(Collections.reverseOrder()) .map(PlainTextFormatter::formatPostSummary).collect(Collectors.joining("\n\n")); } |