aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com/juick/server/CommandsManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-09 18:21:51 +0300
committerGravatar Vitaly Takmazov2018-08-09 18:21:51 +0300
commitbabb3a50a1c7e6101980a9577364b169b5c6654c (patch)
tree27f82bb04c79587bd9d844e916102eb6cc49d1ca /juick-common/src/main/java/com/juick/server/CommandsManager.java
parent244c5aac19f19b64d4e066b1e66da72f704cf36a (diff)
Fix attachments errors
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.java5
1 files changed, 3 insertions, 2 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 d3b85bef..5c034ce3 100644
--- a/juick-common/src/main/java/com/juick/server/CommandsManager.java
+++ b/juick-common/src/main/java/com/juick/server/CommandsManager.java
@@ -115,12 +115,13 @@ public class CommandsManager {
attachmentType = attachmentFName.substring(attachmentFName.length() - 3);
}
int mid = messagesService.createMessage(user.getUid(), body, attachmentType, tags);
- subscriptionService.subscribeMessage(messagesService.getMessage(mid), user);
if (haveAttachment) {
String fname = String.format("%d.%s", mid, attachmentType);
imagesService.saveImageWithPreviews(attachmentFName, fname);
}
- com.juick.Message msg = messagesService.getMessage(mid);
+ Message msg = messagesService.getMessage(mid);
+ subscriptionService.subscribeMessage(msg, user);
+
applicationEventPublisher.publishEvent(new MessageReadEvent(this, 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)));