aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com/juick/server/CommandsManager.java
diff options
context:
space:
mode:
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.java7
1 files changed, 4 insertions, 3 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 734d68fb..cde6a4bf 100644
--- a/juick-common/src/main/java/com/juick/server/CommandsManager.java
+++ b/juick-common/src/main/java/com/juick/server/CommandsManager.java
@@ -102,7 +102,7 @@ public class CommandsManager {
String body = TagUtils.toString(tags).equals(input) ? StringUtils.EMPTY : input.substring(TagUtils.toString(tags).length()).trim();
String attachmentType = StringUtils.isNotEmpty(attachment.toString()) ? attachment.toString().substring(attachment.toString().length() - 3) : null;
int mid = messagesService.createMessage(user.getUid(), body, attachmentType, tags);
- subscriptionService.subscribeMessage(mid, user.getUid());
+ subscriptionService.subscribeMessage(messagesService.getMessage(mid), user);
if (StringUtils.isNotEmpty(attachmentType)) {
String attachmentFName = attachment.getScheme().equals("juick") ? attachment.getHost()
: HttpUtils.downloadImage(attachment.toURL(), tmpDir).getHost();
@@ -335,9 +335,10 @@ public class CommandsManager {
public CommandResult commandSubscribeMessage(User user, URI attachment, String... args) {
boolean subscribe = args[0].equalsIgnoreCase("s");
int mid = NumberUtils.toInt(args[1], 0);
- if (messagesService.getMessage(mid) != null) {
+ Message msg = messagesService.getMessage(mid);
+ if (msg != null) {
if (subscribe) {
- if (subscriptionService.subscribeMessage(mid, user.getUid())) {
+ if (subscriptionService.subscribeMessage(msg, user)) {
return CommandResult.fromString("Subscribed");
}
} else {