X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FNotificationManagerAccessor.java;h=c4468ea6a04e614465648a5f520b6028cdc3aaa5;hb=b03677923ba4734e7596af7f1eb605b31d874e6a;hp=a8f34a8a957c9bdc443d39d34e9036d271a6897e;hpb=ecf753a31601e558b681daab0598009fe9eec99a;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/template/NotificationManagerAccessor.java b/src/main/java/net/pterodactylus/sone/template/NotificationManagerAccessor.java index a8f34a8..c4468ea 100644 --- a/src/main/java/net/pterodactylus/sone/template/NotificationManagerAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/NotificationManagerAccessor.java @@ -21,6 +21,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.notify.ListNotificationFilters; import net.pterodactylus.util.notify.Notification; import net.pterodactylus.util.notify.NotificationManager; import net.pterodactylus.util.template.ReflectionAccessor; @@ -47,13 +49,9 @@ public class NotificationManagerAccessor extends ReflectionAccessor { public Object get(TemplateContext templateContext, Object object, String member) { NotificationManager notificationManager = (NotificationManager) object; if ("all".equals(member)) { - List notifications = new ArrayList(notificationManager.getNotifications()); + List notifications = ListNotificationFilters.filterNotifications(new ArrayList(notificationManager.getNotifications()), (Sone) templateContext.get("currentSone")); Collections.sort(notifications, Notification.CREATED_TIME_SORTER); return notifications; - } else if ("new".equals(member)) { - List notifications = new ArrayList(notificationManager.getChangedNotifications()); - Collections.sort(notifications, Notification.LAST_UPDATED_TIME_SORTER); - return notifications; } return super.get(templateContext, object, member); }