From 4dd89bc86c5223ee40ccc8ddb4d21aa6d5e5b64e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 11 Oct 2020 23:18:40 +0300 Subject: Do not subscribe anonymous user to comments --- src/main/java/com/juick/CommandsManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/juick') diff --git a/src/main/java/com/juick/CommandsManager.java b/src/main/java/com/juick/CommandsManager.java index 66a45f9d..3795e2b6 100644 --- a/src/main/java/com/juick/CommandsManager.java +++ b/src/main/java/com/juick/CommandsManager.java @@ -138,7 +138,9 @@ public class CommandsManager { } Message msg = messagesService.getMessage(mid).orElseThrow(IllegalStateException::new); msg.getUser().setAvatar(webApp.getAvatarUrl(msg.getUser())); - subscriptionService.subscribeMessage(msg, user); + if (!user.isAnonymous()) { + subscriptionService.subscribeMessage(msg, user); + } applicationEventPublisher.publishEvent(new SystemEvent(this, SystemActivity.read(user, msg))); applicationEventPublisher.publishEvent(new SystemEvent(this, @@ -562,7 +564,9 @@ public class CommandsManager { applicationEventPublisher.publishEvent( new SystemEvent(this, SystemActivity.read(user, msg.get()))); Message original = messagesService.getMessage(mid).orElseThrow(IllegalStateException::new); - subscriptionService.subscribeMessage(original, user); + if (!user.isAnonymous()) { + subscriptionService.subscribeMessage(original, user); + } Message reply = messagesService.getReply(mid, newrid); if (reply.getUser().isAnonymous()) { reply.setUser(activityPubManager.personToUser(reply.getUser().getUri())); -- cgit v1.2.3