aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/MessengerManager.java
diff options
context:
space:
mode:
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))));
}