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;
RenderFilter renderFilter,
LinkedElementRenderFilter linkedElementRenderFilter,
PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter,
- NotificationManager notificationManager) {
+ NotificationManager notificationManager, @Named("newRemotePost") ListNotification<Post> newPostNotification) {
this.sonePlugin = sonePlugin;
this.loaders = loaders;
this.listNotificationFilter = listNotificationFilter;
this.l10nFilter = l10nFilter;
this.translation = translation;
this.notificationManager = notificationManager;
+ this.newPostNotification = newPostNotification;
formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword();
soneTextParser = new SoneTextParser(getCore(), getCore());
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);
return formPassword;
}
- /**
- * Returns the posts that have been announced as new in the
- * {@link #newPostNotification}.
- *
- * @return The new posts
- */
- public Set<Post> getNewPosts() {
- return ImmutableSet.<Post> builder().addAll(newPostNotification.getElements()).addAll(localPostNotification.getElements()).build();
- }
-
@Nonnull
public Collection<Post> getNewPosts(@Nullable Sone currentSone) {
Set<Post> allNewPosts = ImmutableSet.<Post> builder()