Filter notifications that the user is not interested in.
[Sone.git] / src / main / java / net / pterodactylus / sone / notify / ListNotificationFilters.java
index beeb81e..7175519 100644 (file)
@@ -55,12 +55,14 @@ public class ListNotificationFilters {
        public static List<Notification> filterNotifications(Collection<? extends Notification> notifications, Sone currentSone) {
                List<Notification> filteredNotifications = new ArrayList<Notification>();
                for (Notification notification : notifications) {
-                       if (notification.getId().equals("new-post-notification")) {
+                       if (notification.getId().equals("new-sone-notification") && ((currentSone == null) || (currentSone.getOptions().getBooleanOption("ShowNotification/NewSones").get()))) {
+                               filteredNotifications.add(notification);
+                       } else if (notification.getId().equals("new-post-notification") && ((currentSone == null) || (currentSone.getOptions().getBooleanOption("ShowNotification/NewPosts").get()))) {
                                ListNotification<Post> filteredNotification = filterNewPostNotification((ListNotification<Post>) notification, currentSone, true);
                                if (filteredNotification != null) {
                                        filteredNotifications.add(filteredNotification);
                                }
-                       } else if (notification.getId().equals("new-reply-notification")) {
+                       } else if (notification.getId().equals("new-reply-notification") && ((currentSone == null) || (currentSone.getOptions().getBooleanOption("ShowNotification/NewReplies").get()))) {
                                ListNotification<PostReply> filteredNotification = filterNewReplyNotification((ListNotification<PostReply>) notification, currentSone);
                                if (filteredNotification != null) {
                                        filteredNotifications.add(filteredNotification);