aboutsummaryrefslogtreecommitdiff
path: root/juick-common
diff options
context:
space:
mode:
Diffstat (limited to 'juick-common')
-rw-r--r--juick-common/src/main/java/com/juick/server/CommandsManager.java7
-rw-r--r--juick-common/src/main/java/com/juick/service/SubscriptionService.java2
2 files changed, 5 insertions, 4 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 {
diff --git a/juick-common/src/main/java/com/juick/service/SubscriptionService.java b/juick-common/src/main/java/com/juick/service/SubscriptionService.java
index 3bd58aed..d5b9f28d 100644
--- a/juick-common/src/main/java/com/juick/service/SubscriptionService.java
+++ b/juick-common/src/main/java/com/juick/service/SubscriptionService.java
@@ -36,7 +36,7 @@ public interface SubscriptionService {
List<User> getUsersSubscribedToUserRecommendations(int uid, int mid, int muid);
- boolean subscribeMessage(int mid, int vuid);
+ boolean subscribeMessage(Message message, User user);
boolean unSubscribeMessage(int mid, int vuid);