Remove notification if no posts and replies remain.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 5 Apr 2011 09:04:10 +0000 (11:04 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 5 Apr 2011 09:04:10 +0000 (11:04 +0200)
src/main/java/net/pterodactylus/sone/notify/ListNotificationFilters.java

index c4bc728..7da4831 100644 (file)
@@ -103,6 +103,9 @@ public class ListNotificationFilters {
                                newPosts.add(post);
                        }
                }
+               if (newPosts.isEmpty()) {
+                       return null;
+               }
                if (newPosts.size() == newPostNotification.getElements().size()) {
                        return newPostNotification;
                }
@@ -138,6 +141,9 @@ public class ListNotificationFilters {
                                newReplies.add(reply);
                        }
                }
+               if (newReplies.isEmpty()) {
+                       return null;
+               }
                if (newReplies.size() == newReplyNotification.getElements().size()) {
                        return newReplyNotification;
                }