RenderFilter renderFilter,
LinkedElementRenderFilter linkedElementRenderFilter,
PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter,
- NotificationManager notificationManager, @Named("newRemotePost") ListNotification<Post> newPostNotification) {
+ NotificationManager notificationManager, @Named("newRemotePost") ListNotification<Post> newPostNotification,
+ @Named("localPost") ListNotification<Post> localPostNotification) {
this.sonePlugin = sonePlugin;
this.loaders = loaders;
this.listNotificationFilter = listNotificationFilter;
this.translation = translation;
this.notificationManager = notificationManager;
this.newPostNotification = newPostNotification;
+ this.localPostNotification = localPostNotification;
formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword();
soneTextParser = new SoneTextParser(getCore(), getCore());
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);
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);
private void removePost(Post post) {
newPostNotification.remove(post);
- localPostNotification.remove(post);
if (!localSoneMentionedInNewPostOrReply(post)) {
mentionNotification.remove(post);
}