X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fnotify%2FListNotificationFilters.java;h=fe024d6083d7b80daffce5c66430c02f53a36dfd;hb=f0fefbfbc2318e460d5e1f3bd2879a6a21c53ce3;hp=813b82d7176a72ebacf7d1a3011a7cd972b3ee9e;hpb=c0e02c61736ad21287f2f8ce706946594e81dbac;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/notify/ListNotificationFilters.java b/src/main/java/net/pterodactylus/sone/notify/ListNotificationFilters.java index 813b82d..fe024d6 100644 --- a/src/main/java/net/pterodactylus/sone/notify/ListNotificationFilters.java +++ b/src/main/java/net/pterodactylus/sone/notify/ListNotificationFilters.java @@ -84,13 +84,13 @@ public class ListNotificationFilters { * @return The filtered new-post notification, or {@code null} if the * notification should be removed */ - private static ListNotification filterNewPostNotification(ListNotification newPostNotification, Sone currentSone) { + public static ListNotification filterNewPostNotification(ListNotification newPostNotification, Sone currentSone) { if (currentSone == null) { return null; } List newPosts = new ArrayList(); for (Post post : newPostNotification.getElements()) { - if (currentSone.hasFriend(post.getSone().getId()) || currentSone.equals(post.getSone())) { + if (currentSone.hasFriend(post.getSone().getId()) || currentSone.equals(post.getSone()) || currentSone.equals(post.getRecipient())) { newPosts.add(post); } } @@ -119,13 +119,13 @@ public class ListNotificationFilters { * @return The filtered new-reply notification, or {@code null} if the * notification should be removed */ - private static ListNotification filterNewReplyNotification(ListNotification newReplyNotification, Sone currentSone) { + public static ListNotification filterNewReplyNotification(ListNotification newReplyNotification, Sone currentSone) { if (currentSone == null) { return null; } List newReplies = new ArrayList(); for (Reply reply : newReplyNotification.getElements()) { - if (currentSone.hasFriend(reply.getPost().getSone().getId()) || currentSone.equals(reply.getPost().getSone())) { + if (((reply.getPost().getSone() != null) && currentSone.hasFriend(reply.getPost().getSone().getId())) || currentSone.equals(reply.getPost().getSone()) || currentSone.equals(reply.getPost().getRecipient())) { newReplies.add(reply); } }