From 8b6cad7628a282f6092113ba461f482e2cac82f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 9 Dec 2019 21:47:04 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=90=9B=20Use=20new=20new-post=20notificati?= =?utf8?q?on=20in=20web=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../java/net/pterodactylus/sone/web/WebInterface.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 4ed49df..eaa6019 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -35,6 +35,7 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Logger; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import javax.inject.Named; import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.core.ElementLoader; @@ -205,7 +206,7 @@ public class WebInterface implements SessionProvider { RenderFilter renderFilter, LinkedElementRenderFilter linkedElementRenderFilter, PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter, - NotificationManager notificationManager) { + NotificationManager notificationManager, @Named("newRemotePost") ListNotification newPostNotification) { this.sonePlugin = sonePlugin; this.loaders = loaders; this.listNotificationFilter = listNotificationFilter; @@ -222,6 +223,7 @@ public class WebInterface implements SessionProvider { this.l10nFilter = l10nFilter; this.translation = translation; this.notificationManager = notificationManager; + this.newPostNotification = newPostNotification; formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword(); soneTextParser = new SoneTextParser(getCore(), getCore()); @@ -230,9 +232,6 @@ public class WebInterface implements SessionProvider { templateContextFactory.addTemplateObject("formPassword", formPassword); /* create notifications. */ - Template newPostNotificationTemplate = loaders.loadTemplate("/templates/notify/newPostNotification.html"); - newPostNotification = new ListNotification<>("new-post-notification", "posts", newPostNotificationTemplate, false); - Template localPostNotificationTemplate = loaders.loadTemplate("/templates/notify/newPostNotification.html"); localPostNotification = new ListNotification<>("local-post-notification", "posts", localPostNotificationTemplate, false); @@ -396,16 +395,6 @@ public class WebInterface implements SessionProvider { return formPassword; } - /** - * Returns the posts that have been announced as new in the - * {@link #newPostNotification}. - * - * @return The new posts - */ - public Set getNewPosts() { - return ImmutableSet. builder().addAll(newPostNotification.getElements()).addAll(localPostNotification.getElements()).build(); - } - @Nonnull public Collection getNewPosts(@Nullable Sone currentSone) { Set allNewPosts = ImmutableSet. builder() -- 2.7.4