From 68789ca6c3972db476a325cd5c1bdc70cd7962f6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 25 Sep 2018 13:02:14 +0300 Subject: update juick-server to new events api --- .../src/main/java/com/juick/server/CommandsManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'juick-server/src/main/java/com/juick/server/CommandsManager.java') 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 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); -- cgit v1.2.3