aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/MessengerManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-12 14:17:46 +0300
committerGravatar Vitaly Takmazov2018-04-12 14:17:46 +0300
commit9e5a6b3f2f6907f18f22718bcb6f0ac7f79c95cd (patch)
tree06d4eab436f56607f324cd2c43808854c35a6dfc /juick-server/src/main/java/com/juick/server/MessengerManager.java
parente24f7a7ce9eb765aa2f581defbe20433a647700d (diff)
server: MessageEvent now have list of subscribers
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/MessengerManager.java')
-rw-r--r--juick-server/src/main/java/com/juick/server/MessengerManager.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/server/MessengerManager.java b/juick-server/src/main/java/com/juick/server/MessengerManager.java
index 9192288f..323eef7c 100644
--- a/juick-server/src/main/java/com/juick/server/MessengerManager.java
+++ b/juick-server/src/main/java/com/juick/server/MessengerManager.java
@@ -34,6 +34,7 @@ import java.net.URI;
import java.net.URL;
import java.time.Instant;
import java.util.Collections;
+import java.util.List;
import java.util.Optional;
import static com.juick.formatters.PlainTextFormatter.formatPost;
@@ -45,8 +46,6 @@ public class MessengerManager implements ApplicationListener<MessageEvent> {
@Inject
private MessagesService messagesService;
@Inject
- private SubscriptionService subscriptionService;
- @Inject
private UserService userService;
@Inject
private MessengerService messengerService;
@@ -111,15 +110,16 @@ public class MessengerManager implements ApplicationListener<MessageEvent> {
@Override
public void onApplicationEvent(@Nonnull MessageEvent event) {
Message msg = event.getMessage();
+ List<User> subscribedUsers = event.getUsers();
if (msg.getMid() > 0 && msg.getRid() == 0) {
String subject = formatPost(msg);
- subscriptionService.getSubscribedUsers(msg.getUser().getUid(), msg.getMid())
+ subscribedUsers
.forEach(user -> messengerService.getSenderId(user)
.ifPresent(t -> messengerNotify(t, subject, formatUrl(msg))));
} else if (msg.getRid() > 0) {
Message op = messagesService.getMessage(msg.getMid());
String subject = formatPost(msg);
- subscriptionService.getUsersSubscribedToComments(op, msg)
+ subscribedUsers
.forEach(user -> messengerService.getSenderId(user)
.ifPresent(t -> messengerNotify(t, subject, formatUrl(msg))));
}