X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=4ed49df3184f83a1ddb83ab02999703fc5bf1e4d;hb=0dc7811a459455dd2b670eb1924df27f65c36a24;hp=588ffb7cf07e8f79e1ae19a29168b6261aa45a92;hpb=d5cd41949b7e62fdc40ef7390661dcda8c18a139;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 588ffb7..4ed49df 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -69,7 +69,6 @@ import net.pterodactylus.sone.web.ajax.DeletePostAjaxPage; import net.pterodactylus.sone.web.ajax.DeleteProfileFieldAjaxPage; import net.pterodactylus.sone.web.ajax.DeleteReplyAjaxPage; import net.pterodactylus.sone.web.ajax.DismissNotificationAjaxPage; -import net.pterodactylus.sone.web.ajax.DistrustAjaxPage; import net.pterodactylus.sone.web.ajax.EditAlbumAjaxPage; import net.pterodactylus.sone.web.ajax.EditImageAjaxPage; import net.pterodactylus.sone.web.ajax.EditProfileFieldAjaxPage; @@ -86,12 +85,10 @@ import net.pterodactylus.sone.web.ajax.LikeAjaxPage; import net.pterodactylus.sone.web.ajax.LockSoneAjaxPage; import net.pterodactylus.sone.web.ajax.MarkAsKnownAjaxPage; import net.pterodactylus.sone.web.ajax.MoveProfileFieldAjaxPage; -import net.pterodactylus.sone.web.ajax.TrustAjaxPage; import net.pterodactylus.sone.web.ajax.UnbookmarkAjaxPage; import net.pterodactylus.sone.web.ajax.UnfollowSoneAjaxPage; import net.pterodactylus.sone.web.ajax.UnlikeAjaxPage; import net.pterodactylus.sone.web.ajax.UnlockSoneAjaxPage; -import net.pterodactylus.sone.web.ajax.UntrustAjaxPage; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.sone.web.page.TemplateRenderer; import net.pterodactylus.sone.web.pages.*; @@ -127,7 +124,7 @@ public class WebInterface implements SessionProvider { private final Loaders loaders; /** The notification manager. */ - private final NotificationManager notificationManager = new NotificationManager(); + private final NotificationManager notificationManager; /** The Sone plugin. */ private final SonePlugin sonePlugin; @@ -160,9 +157,6 @@ public class WebInterface implements SessionProvider { private final MetricRegistry metricRegistry; private final Translation translation; - /** The “new Sone” notification. */ - private final ListNotification newSoneNotification; - /** The “new post” notification. */ private final ListNotification newPostNotification; @@ -210,7 +204,8 @@ public class WebInterface implements SessionProvider { ParserFilter parserFilter, ShortenFilter shortenFilter, RenderFilter renderFilter, LinkedElementRenderFilter linkedElementRenderFilter, - PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter) { + PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter, + NotificationManager notificationManager) { this.sonePlugin = sonePlugin; this.loaders = loaders; this.listNotificationFilter = listNotificationFilter; @@ -226,6 +221,7 @@ public class WebInterface implements SessionProvider { this.metricRegistry = metricRegistry; this.l10nFilter = l10nFilter; this.translation = translation; + this.notificationManager = notificationManager; formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword(); soneTextParser = new SoneTextParser(getCore(), getCore()); @@ -234,9 +230,6 @@ public class WebInterface implements SessionProvider { templateContextFactory.addTemplateObject("formPassword", formPassword); /* create notifications. */ - Template newSoneNotificationTemplate = loaders.loadTemplate("/templates/notify/newSoneNotification.html"); - newSoneNotification = new ListNotification<>("new-sone-notification", "sones", newSoneNotificationTemplate, false); - Template newPostNotificationTemplate = loaders.loadTemplate("/templates/notify/newPostNotification.html"); newPostNotification = new ListNotification<>("new-post-notification", "posts", newPostNotificationTemplate, false); @@ -574,9 +567,6 @@ public class WebInterface implements SessionProvider { pageToadletRegistry.addPage(new UploadImagePage(this, loaders, templateRenderer)); pageToadletRegistry.addPage(new EditImagePage(this, loaders, templateRenderer)); pageToadletRegistry.addPage(new DeleteImagePage(this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new TrustPage(this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new DistrustPage(this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new UntrustPage(this, loaders, templateRenderer)); pageToadletRegistry.addPage(new MarkAsKnownPage(this, loaders, templateRenderer)); pageToadletRegistry.addPage(new BookmarkPage(this, loaders, templateRenderer)); pageToadletRegistry.addPage(new UnbookmarkPage(this, loaders, templateRenderer)); @@ -619,9 +609,6 @@ public class WebInterface implements SessionProvider { pageToadletRegistry.addPage(new UnfollowSoneAjaxPage(this)); pageToadletRegistry.addPage(new EditAlbumAjaxPage(this)); pageToadletRegistry.addPage(new EditImageAjaxPage(this, parserFilter, shortenFilter, renderFilter)); - pageToadletRegistry.addPage(new TrustAjaxPage(this)); - pageToadletRegistry.addPage(new DistrustAjaxPage(this)); - pageToadletRegistry.addPage(new UntrustAjaxPage(this)); pageToadletRegistry.addPage(new LikeAjaxPage(this)); pageToadletRegistry.addPage(new UnlikeAjaxPage(this)); pageToadletRegistry.addPage(new GetLikesAjaxPage(this)); @@ -697,20 +684,6 @@ public class WebInterface implements SessionProvider { // /** - * Notifies the web interface that a new {@link Sone} was found. - * - * @param newSoneFoundEvent - * The event - */ - @Subscribe - public void newSoneFound(NewSoneFoundEvent newSoneFoundEvent) { - newSoneNotification.add(newSoneFoundEvent.getSone()); - if (!hasFirstStartNotification()) { - notificationManager.addNotification(newSoneNotification); - } - } - - /** * Notifies the web interface that a new {@link Post} was found. * * @param newPostFoundEvent @@ -722,17 +695,15 @@ public class WebInterface implements SessionProvider { boolean isLocal = post.getSone().isLocal(); if (isLocal) { localPostNotification.add(post); - } else { - newPostNotification.add(post); } if (!hasFirstStartNotification()) { - notificationManager.addNotification(isLocal ? localPostNotification : newPostNotification); + if (isLocal) { + notificationManager.addNotification(localPostNotification); + } if (!getMentionedSones(post.getText()).isEmpty() && !isLocal) { mentionNotification.add(post); notificationManager.addNotification(mentionNotification); } - } else { - getCore().markPostKnown(post); } } @@ -762,17 +733,6 @@ public class WebInterface implements SessionProvider { } } - /** - * Notifies the web interface that a {@link Sone} was marked as known. - * - * @param markSoneKnownEvent - * The event - */ - @Subscribe - public void markSoneKnown(MarkSoneKnownEvent markSoneKnownEvent) { - newSoneNotification.remove(markSoneKnownEvent.getSone()); - } - @Subscribe public void markPostKnown(MarkPostKnownEvent markPostKnownEvent) { removePost(markPostKnownEvent.getPost()); @@ -784,11 +744,6 @@ public class WebInterface implements SessionProvider { } @Subscribe - public void soneRemoved(SoneRemovedEvent soneRemovedEvent) { - newSoneNotification.remove(soneRemovedEvent.getSone()); - } - - @Subscribe public void postRemoved(PostRemovedEvent postRemovedEvent) { removePost(postRemovedEvent.getPost()); }