X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=45ce1844b260295ce84259aec34d68d1053f9f46;hp=c9547fbca28997c2943fb90cb894fce6f0138916;hb=a7e65e23d6dae37ebf88ba5a0eb58239205c7e2e;hpb=282916447c6f35a5c461c58011c3fa7d1343cecc diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index c9547fb..45ce184 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -168,6 +168,12 @@ public class WebInterface implements CoreListener { /** The “new reply” notification. */ private final ListNotification newReplyNotification; + /** The invisible “local post” notification. */ + private final ListNotification localPostNotification; + + /** The invisible “local reply” notification. */ + private final ListNotification localReplyNotification; + /** The “you have been mentioned” notification. */ private final ListNotification mentionNotification; @@ -235,9 +241,11 @@ public class WebInterface implements CoreListener { Template newPostNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newPostNotification.html")); newPostNotification = new ListNotification("new-post-notification", "posts", newPostNotificationTemplate, false); + localPostNotification = new ListNotification("local-post-notification", "posts", newPostNotificationTemplate, false); Template newReplyNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newReplyNotification.html")); newReplyNotification = new ListNotification("new-reply-notification", "replies", newReplyNotificationTemplate, false); + localReplyNotification = new ListNotification("local-reply-notification", "replies", newReplyNotificationTemplate, false); Template mentionNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/mentionNotification.html")); mentionNotification = new ListNotification("mention-notification", "posts", mentionNotificationTemplate, false); @@ -731,10 +739,15 @@ public class WebInterface implements CoreListener { */ @Override public void newPostFound(Post post) { - newPostNotification.add(post); + boolean isLocal = getCore().isLocalSone(post.getSone()); + if (isLocal) { + localPostNotification.add(post); + } else { + newPostNotification.add(post); + } if (!hasFirstStartNotification()) { - notificationManager.addNotification(newPostNotification); - if (!getMentionedSones(post.getText()).isEmpty()) { + notificationManager.addNotification(isLocal ? localPostNotification : newPostNotification); + if (!getMentionedSones(post.getText()).isEmpty() && !isLocal) { mentionNotification.add(post); notificationManager.addNotification(mentionNotification); } @@ -751,10 +764,15 @@ public class WebInterface implements CoreListener { if (reply.getPost().getSone() == null) { return; } - newReplyNotification.add(reply); + boolean isLocal = getCore().isLocalSone(reply.getSone()); + if (isLocal) { + localReplyNotification.add(reply); + } else { + newReplyNotification.add(reply); + } if (!hasFirstStartNotification()) { - notificationManager.addNotification(newReplyNotification); - if (!getMentionedSones(reply.getText()).isEmpty()) { + notificationManager.addNotification(isLocal ? localReplyNotification : newReplyNotification); + if (!getMentionedSones(reply.getText()).isEmpty() && !isLocal) { mentionNotification.add(reply.getPost()); notificationManager.addNotification(mentionNotification); } @@ -777,6 +795,7 @@ public class WebInterface implements CoreListener { @Override public void markPostKnown(Post post) { newPostNotification.remove(post); + localPostNotification.remove(post); mentionNotification.remove(post); } @@ -786,6 +805,7 @@ public class WebInterface implements CoreListener { @Override public void markReplyKnown(Reply reply) { newReplyNotification.remove(reply); + localReplyNotification.remove(reply); mentionNotification.remove(reply.getPost()); } @@ -803,6 +823,7 @@ public class WebInterface implements CoreListener { @Override public void postRemoved(Post post) { newPostNotification.remove(post); + localPostNotification.remove(post); } /** @@ -811,6 +832,7 @@ public class WebInterface implements CoreListener { @Override public void replyRemoved(Reply reply) { newReplyNotification.remove(reply); + localReplyNotification.remove(reply); } /**