aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-03-23 00:32:57 +0300
committerGravatar Vitaly Takmazov2022-03-23 00:32:57 +0300
commit2788060f586efb13cce6fa2b11dbfee630546ece (patch)
tree144e4926bf9eab1edbd14c0a349f5db44a73fc4d /src/main
parent42769a27edc7718231ebfa6ca723a8b0d80f4e30 (diff)
Return correct replies counter on /thread API endpoint
* replies counter will not include replies from banned users now
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/www/api/Messages.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java
index a782f680..ab222a3c 100644
--- a/src/main/java/com/juick/www/api/Messages.java
+++ b/src/main/java/com/juick/www/api/Messages.java
@@ -175,6 +175,8 @@ public class Messages {
.map(Pair::getRight).collect(Collectors.toList())));
msg.getRecommendations().forEach(r -> r.setAvatar(webApp.getAvatarUrl(r)));
List<Message> replies = messagesService.getReplies(visitor, mid);
+ // update replies counter to exclude banned replies
+ msg.setReplies(replies.size());
replies.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser())));
if (!visitor.isAnonymous()) {
userService.updateLastSeen(visitor);