Let the list notification dismiss itself automatically when it’s empty.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 17 Nov 2010 20:45:46 +0000 (21:45 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 17 Nov 2010 20:45:46 +0000 (21:45 +0100)
src/main/java/net/pterodactylus/sone/notify/ListNotification.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java

index 64c2ecb..423bea4 100644 (file)
@@ -84,6 +84,9 @@ public class ListNotification<T> extends TemplateNotification {
         */
        public void remove(T element) {
                elements.remove(element);
+               if (elements.isEmpty()) {
+                       dismiss();
+               }
                touch();
        }
 
index db1880b..747b192 100644 (file)
@@ -419,9 +419,6 @@ public class WebInterface implements CoreListener {
        @Override
        public void markSoneKnown(Sone sone) {
                newSoneNotification.remove(sone);
-               if (newSoneNotification.isEmpty()) {
-                       newSoneNotification.dismiss();
-               }
        }
 
        /**
@@ -430,9 +427,6 @@ public class WebInterface implements CoreListener {
        @Override
        public void markPostKnown(Post post) {
                newPostNotification.remove(post);
-               if (newPostNotification.isEmpty()) {
-                       newPostNotification.dismiss();
-               }
        }
 
        /**
@@ -441,9 +435,6 @@ public class WebInterface implements CoreListener {
        @Override
        public void markReplyKnown(Reply reply) {
                newReplyNotification.remove(reply);
-               if (newReplyNotification.isEmpty()) {
-                       newReplyNotification.dismiss();
-               }
        }
 
        /**