diff options
author | Vitaly Takmazov | 2018-04-12 00:41:57 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-12 00:41:57 +0300 |
commit | 97ffb90f765078aca3e4d6d173a6c93182d9165c (patch) | |
tree | 7e9c985d6b682522905c1ef63ec5cea63cbaf72a /juick-common/src/main/java/com | |
parent | e319dda17260334262603df9cdc18fe52d6c164b (diff) |
subscription mark all comments read
Diffstat (limited to 'juick-common/src/main/java/com')
-rw-r--r-- | juick-common/src/main/java/com/juick/server/CommandsManager.java | 7 | ||||
-rw-r--r-- | juick-common/src/main/java/com/juick/service/SubscriptionService.java | 2 |
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); |