X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=027fb7f2283946ff6b4fc7b3334e42686693e5d3;hp=5bb4e3a8274f7356ff3ef71512db081030a1a1cd;hb=79ef6e4644845290d9feb45a06f8588864dd0a83;hpb=8d9f18ad6233388b4b1beb4e457ad211015b90a4 diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 5bb4e3a..027fb7f 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -169,7 +169,9 @@ public class WebInterface implements SessionProvider { LinkedElementRenderFilter linkedElementRenderFilter, PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter, NotificationManager notificationManager, @Named("newRemotePost") ListNotification newPostNotification, - @Named("localPost") ListNotification localPostNotification) { + @Named("newRemotePostReply") ListNotification newReplyNotification, + @Named("localPost") ListNotification localPostNotification, + @Named("localReply") ListNotification localReplyNotification) { this.sonePlugin = sonePlugin; this.loaders = loaders; this.listNotificationFilter = listNotificationFilter; @@ -187,19 +189,14 @@ public class WebInterface implements SessionProvider { this.translation = translation; this.notificationManager = notificationManager; this.newPostNotification = newPostNotification; + this.newReplyNotification = newReplyNotification; this.localPostNotification = localPostNotification; + this.localReplyNotification = localReplyNotification; formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword(); this.templateContextFactory = templateContextFactory; templateContextFactory.addTemplateObject("webInterface", this); templateContextFactory.addTemplateObject("formPassword", formPassword); - - /* create notifications. */ - Template newReplyNotificationTemplate = loaders.loadTemplate("/templates/notify/newReplyNotification.html"); - newReplyNotification = new ListNotification<>("new-reply-notification", "replies", newReplyNotificationTemplate, false); - - Template localReplyNotificationTemplate = loaders.loadTemplate("/templates/notify/newReplyNotification.html"); - localReplyNotification = new ListNotification<>("local-reply-notification", "replies", localReplyNotificationTemplate, false); } // @@ -515,39 +512,12 @@ public class WebInterface implements SessionProvider { // EVENT HANDLERS // - /** - * Notifies the web interface that a new {@link PostReply} was found. - * - * @param newPostReplyFoundEvent - * The event - */ - @Subscribe - public void newReplyFound(NewPostReplyFoundEvent newPostReplyFoundEvent) { - PostReply reply = newPostReplyFoundEvent.getPostReply(); - boolean isLocal = reply.getSone().isLocal(); - if (isLocal) { - localReplyNotification.add(reply); - } else { - newReplyNotification.add(reply); - } - if (!hasFirstStartNotification()) { - notificationManager.addNotification(isLocal ? localReplyNotification : newReplyNotification); - } else { - getCore().markReplyKnown(reply); - } - } - @Subscribe public void markPostKnown(MarkPostKnownEvent markPostKnownEvent) { removePost(markPostKnownEvent.getPost()); } @Subscribe - public void markReplyKnown(MarkPostReplyKnownEvent markPostReplyKnownEvent) { - removeReply(markPostReplyKnownEvent.getPostReply()); - } - - @Subscribe public void postRemoved(PostRemovedEvent postRemovedEvent) { removePost(postRemovedEvent.getPost()); } @@ -556,16 +526,6 @@ public class WebInterface implements SessionProvider { newPostNotification.remove(post); } - @Subscribe - public void replyRemoved(PostReplyRemovedEvent postReplyRemovedEvent) { - removeReply(postReplyRemovedEvent.getPostReply()); - } - - private void removeReply(PostReply reply) { - newReplyNotification.remove(reply); - localReplyNotification.remove(reply); - } - /** * Notifies the web interface that a {@link Sone} is being inserted. *