diff options
author | Vitaly Takmazov | 2018-04-04 22:20:52 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-04 22:20:52 +0300 |
commit | 71c29cc99d1b3f71247b81bc42d30f8b52dad240 (patch) | |
tree | d859abf882d2a40e5130fbb210ab3dea8d582d42 /juick-notifications | |
parent | f86e3e089ff4e4e27133156e277c94d4cd8c7111 (diff) |
server: PMs in email
* also introduces MessageUtils.isReply and MessageUtils.isPM
Diffstat (limited to 'juick-notifications')
-rw-r--r-- | juick-notifications/src/main/java/com/juick/components/Notifications.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/juick-notifications/src/main/java/com/juick/components/Notifications.java b/juick-notifications/src/main/java/com/juick/components/Notifications.java index a43d985c..410debd4 100644 --- a/juick-notifications/src/main/java/com/juick/components/Notifications.java +++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java @@ -81,18 +81,16 @@ public class Notifications implements NotificationClientListener, AutoCloseable, @Override public void onApplicationEvent(@Nonnull MessageEvent event) { com.juick.Message jmsg = event.getMessage(); - boolean isPM = jmsg.getMid() == 0; - boolean isReply = jmsg.getRid() > 0; User pmTo = jmsg.getTo(); final List<User> users = new ArrayList<>(); - if (isPM) { + if (MessageUtils.isPM(jmsg)) { users.addAll(rest.exchange(String.format("http://api.juick.com/notifications?uid=%d", pmTo.getUid()), HttpMethod.GET, null, new ParameterizedTypeReference<List<User>>() { }).getBody()); } else { - if (isReply) { + if (MessageUtils.isReply(jmsg)) { users.addAll(rest.exchange(String.format("http://api.juick.com/notifications?uid=%d&mid=%d&rid=%d", jmsg.getUser().getUid(), jmsg.getMid(), jmsg.getRid()), HttpMethod.GET, null, new ParameterizedTypeReference<List<User>>() { |