aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com/juick/server/CommandsManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-03 12:38:18 +0300
committerGravatar Vitaly Takmazov2018-08-03 12:38:18 +0300
commit162262eb58c4642b7ffb9ed41bc760e0f009d6a6 (patch)
treeb72b3b1807c561c61c3c40c27f07ba3e012acd73 /juick-common/src/main/java/com/juick/server/CommandsManager.java
parent798e8da8737c4fe5fee8dfaa7f98bfa13e2d91da (diff)
replies counter in feeds reflect banned comments
Diffstat (limited to 'juick-common/src/main/java/com/juick/server/CommandsManager.java')
-rw-r--r--juick-common/src/main/java/com/juick/server/CommandsManager.java14
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 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<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"));
}