From 45a1231bfe72c7853aa1cbbb882ec33df11fe320 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 12 Jan 2018 12:24:20 +0300 Subject: prepare to handle PMs from ws components --- juick-api/src/main/java/com/juick/api/EmailManager.java | 2 +- juick-api/src/main/java/com/juick/api/MessengerManager.java | 2 +- juick-api/src/main/java/com/juick/api/TelegramBotManager.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'juick-api') diff --git a/juick-api/src/main/java/com/juick/api/EmailManager.java b/juick-api/src/main/java/com/juick/api/EmailManager.java index c90e7b7a..f30413c6 100644 --- a/juick-api/src/main/java/com/juick/api/EmailManager.java +++ b/juick-api/src/main/java/com/juick/api/EmailManager.java @@ -45,7 +45,7 @@ public class EmailManager implements ApplicationListener { @Override public void onApplicationEvent(@Nonnull MessageEvent event) { Message msg = event.getMessage(); - if (msg.getRid() == 0) { + if (msg.getMid() > 0 && msg.getRid() == 0) { String subject = String.format("New message from %s", msg.getUser().getName()); subscriptionService.getSubscribedUsers(msg.getUser().getUid(), msg.getMid()) .forEach(user -> emailService.getEmails(user.getUid(), true) diff --git a/juick-api/src/main/java/com/juick/api/MessengerManager.java b/juick-api/src/main/java/com/juick/api/MessengerManager.java index 2008144a..75c496c8 100644 --- a/juick-api/src/main/java/com/juick/api/MessengerManager.java +++ b/juick-api/src/main/java/com/juick/api/MessengerManager.java @@ -105,7 +105,7 @@ public class MessengerManager implements ApplicationListener { @Override public void onApplicationEvent(@Nonnull MessageEvent event) { Message msg = event.getMessage(); - if (msg.getRid() == 0) { + if (msg.getMid() > 0 && msg.getRid() == 0) { String subject = formatPost(msg); subscriptionService.getSubscribedUsers(msg.getUser().getUid(), msg.getMid()) .forEach(user -> messengerService.getSenderId(user) diff --git a/juick-api/src/main/java/com/juick/api/TelegramBotManager.java b/juick-api/src/main/java/com/juick/api/TelegramBotManager.java index 0417afe1..801bb0a7 100644 --- a/juick-api/src/main/java/com/juick/api/TelegramBotManager.java +++ b/juick-api/src/main/java/com/juick/api/TelegramBotManager.java @@ -86,7 +86,7 @@ public class TelegramBotManager implements ApplicationListener { public void onApplicationEvent(@Nonnull MessageEvent event) { com.juick.Message jmsg = event.getMessage(); String msgUrl = formatUrl(jmsg); - if (jmsg.getRid() == 0) { + if (jmsg.getMid() > 0 && jmsg.getRid() == 0) { String msg = String.format("[%s](%s) %s", MSG_LINK, msgUrl, formatPost(jmsg)); List users = telegramService.getTelegramIdentifiers(subscriptionService.getSubscribedUsers(jmsg.getUser().getUid(), jmsg.getMid())); -- cgit v1.2.3