LinkedElementRenderFilter linkedElementRenderFilter,
PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter,
NotificationManager notificationManager, @Named("newRemotePost") ListNotification<Post> newPostNotification,
- @Named("localPost") ListNotification<Post> localPostNotification) {
+ @Named("newRemotePostReply") ListNotification<PostReply> newReplyNotification,
+ @Named("localPost") ListNotification<Post> localPostNotification,
+ @Named("localReply") ListNotification<PostReply> localReplyNotification) {
this.sonePlugin = sonePlugin;
this.loaders = loaders;
this.listNotificationFilter = listNotificationFilter;
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);
}
//
// 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);
- }
- }
-
@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());
}
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.
*