X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=07f147681d7640cc45b6ed19b649b45b7b16f864;hb=e6768e198b1644393e63947a0fc45f1c72ae474b;hp=b4c5942c684288997b522094ad329074405ef4ef;hpb=b2952fda6d34528489d7fa4e26e09133099c978f;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 b4c5942..07f1476 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -21,7 +21,6 @@ import static com.google.common.collect.FluentIterable.from; import static java.util.logging.Logger.getLogger; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -30,7 +29,6 @@ import java.util.TimeZone; import java.util.UUID; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; import javax.annotation.Nonnull; @@ -176,12 +174,6 @@ public class WebInterface implements SessionProvider { /** Notifications for sone inserts. */ private final Map soneInsertNotifications = new HashMap<>(); - /** Sone locked notification ticker objects. */ - private final Map> lockedSonesTickerObjects = Collections.synchronizedMap(new HashMap>()); - - /** The “new version” notification. */ - private final TemplateNotification newVersionNotification; - /** The “inserting images” notification. */ private final ListNotification insertingImagesNotification; @@ -203,7 +195,8 @@ public class WebInterface implements SessionProvider { RenderFilter renderFilter, LinkedElementRenderFilter linkedElementRenderFilter, PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter, - NotificationManager notificationManager, @Named("newRemotePost") ListNotification newPostNotification) { + NotificationManager notificationManager, @Named("newRemotePost") ListNotification newPostNotification, + @Named("localPost") ListNotification localPostNotification) { this.sonePlugin = sonePlugin; this.loaders = loaders; this.listNotificationFilter = listNotificationFilter; @@ -221,6 +214,7 @@ public class WebInterface implements SessionProvider { this.translation = translation; this.notificationManager = notificationManager; this.newPostNotification = newPostNotification; + this.localPostNotification = localPostNotification; formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword(); soneTextParser = new SoneTextParser(getCore(), getCore()); @@ -229,9 +223,6 @@ public class WebInterface implements SessionProvider { templateContextFactory.addTemplateObject("formPassword", formPassword); /* create notifications. */ - Template localPostNotificationTemplate = loaders.loadTemplate("/templates/notify/newPostNotification.html"); - localPostNotification = new ListNotification<>("local-post-notification", "posts", localPostNotificationTemplate, false); - Template newReplyNotificationTemplate = loaders.loadTemplate("/templates/notify/newReplyNotification.html"); newReplyNotification = new ListNotification<>("new-reply-notification", "replies", newReplyNotificationTemplate, false); @@ -241,9 +232,6 @@ public class WebInterface implements SessionProvider { Template mentionNotificationTemplate = loaders.loadTemplate("/templates/notify/mentionNotification.html"); mentionNotification = new ListNotification<>("mention-notification", "posts", mentionNotificationTemplate, false); - Template newVersionTemplate = loaders.loadTemplate("/templates/notify/newVersionNotification.html"); - newVersionNotification = new TemplateNotification("new-version-notification", newVersionTemplate); - Template insertingImagesTemplate = loaders.loadTemplate("/templates/notify/inserting-images-notification.html"); insertingImagesNotification = new ListNotification<>("inserting-images-notification", "images", insertingImagesTemplate); @@ -676,13 +664,7 @@ public class WebInterface implements SessionProvider { public void newPostFound(NewPostFoundEvent newPostFoundEvent) { Post post = newPostFoundEvent.getPost(); boolean isLocal = post.getSone().isLocal(); - if (isLocal) { - localPostNotification.add(post); - } if (!hasFirstStartNotification()) { - if (isLocal) { - notificationManager.addNotification(localPostNotification); - } if (!getMentionedSones(post.getText()).isEmpty() && !isLocal) { mentionNotification.add(post); notificationManager.addNotification(mentionNotification); @@ -733,7 +715,6 @@ public class WebInterface implements SessionProvider { private void removePost(Post post) { newPostNotification.remove(post); - localPostNotification.remove(post); if (!localSoneMentionedInNewPostOrReply(post)) { mentionNotification.remove(post); } @@ -800,21 +781,6 @@ public class WebInterface implements SessionProvider { } /** - * Notifies the web interface that a new Sone version was found. - * - * @param updateFoundEvent - * The event - */ - @Subscribe - public void updateFound(UpdateFoundEvent updateFoundEvent) { - newVersionNotification.set("latestVersion", updateFoundEvent.getVersion()); - newVersionNotification.set("latestEdition", updateFoundEvent.getLatestEdition()); - newVersionNotification.set("releaseTime", updateFoundEvent.getReleaseTime()); - newVersionNotification.set("disruptive", updateFoundEvent.isDisruptive()); - notificationManager.addNotification(newVersionNotification); - } - - /** * Notifies the web interface that an image insert was started * * @param imageInsertStartedEvent