diff options
author | Vitaly Takmazov | 2018-09-25 13:02:14 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-09-25 13:02:14 +0300 |
commit | 68789ca6c3972db476a325cd5c1bdc70cd7962f6 (patch) | |
tree | 7429a98fdcc05eaf76b3e8cf625ba3f21288d79d /juick-server/src/main/java/com/juick/server/CommandsManager.java | |
parent | 15753b2ebdac2ab49cf5682c417851a0653e136e (diff) |
update juick-server to new events api
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/CommandsManager.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/CommandsManager.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/server/CommandsManager.java b/juick-server/src/main/java/com/juick/server/CommandsManager.java index 018cef15..53b93d4c 100644 --- a/juick-server/src/main/java/com/juick/server/CommandsManager.java +++ b/juick-server/src/main/java/com/juick/server/CommandsManager.java @@ -122,7 +122,7 @@ public class CommandsManager { Message msg = messagesService.getMessage(mid); subscriptionService.subscribeMessage(msg, user); - applicationEventPublisher.publishEvent(new MessageReadEvent(this, user, msg)); + applicationEventPublisher.publishEvent(new MessageReadEvent(this, Collections.singletonList(user), msg)); applicationEventPublisher.publishEvent(new MessageEvent(this, msg, subscriptionService.getSubscribedUsers(msg.getUser().getUid(), msg.getMid()))); return CommandResult.build(msg, "New message posted.\n#" + msg.getMid() + " https://juick.com/m/" + msg.getMid(), String.format("[New message](%s) posted", PlainTextFormatter.formatUrl(msg))); } @@ -356,7 +356,8 @@ public class CommandsManager { if (msg != null) { if (subscribe) { if (subscriptionService.subscribeMessage(msg, user)) { - applicationEventPublisher.publishEvent(new MessageReadEvent(this, user, msg)); + applicationEventPublisher.publishEvent( + new MessageReadEvent(this, Collections.singletonList(user), msg)); return CommandResult.fromString("Subscribed"); } } else { @@ -408,7 +409,8 @@ public class CommandsManager { if (msg != null) { if (showReplies) { List<com.juick.Message> replies = messagesService.getReplies(user, mid); - applicationEventPublisher.publishEvent(new MessageReadEvent(this, user, msg)); + applicationEventPublisher.publishEvent( + new MessageReadEvent(this, Collections.singletonList(user), msg)); replies.add(0, msg); return CommandResult.fromString(String.join("\n", replies.stream().map(PlainTextFormatter::formatPostSummary).collect(Collectors.toList()))); @@ -508,7 +510,8 @@ public class CommandsManager { attachmentType = attachmentFName.substring(attachmentFName.length() - 3); } int newrid = messagesService.createReply(mid, rid, user, txt, attachmentType); - applicationEventPublisher.publishEvent(new MessageReadEvent(this, user, msg)); + applicationEventPublisher.publishEvent( + new MessageReadEvent(this, Collections.singletonList(user), msg)); if (haveAttachment) { String fname = String.format("%d-%d.%s", mid, newrid, attachmentType); imagesService.saveImageWithPreviews(attachmentFName, fname); |