From: David ‘Bombe’ Roden Date: Wed, 23 Nov 2011 06:08:32 +0000 (+0100) Subject: Remove mention notifications if elements are removed. X-Git-Tag: 0.7.5^2~5 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=12ef4ab5bf492dd3d50ebfa66d662d1e98f430a2;p=Sone.git Remove mention notifications if elements are removed. --- diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 5ba3be7..4dc048c 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -872,6 +872,7 @@ public class WebInterface implements CoreListener { public void postRemoved(Post post) { newPostNotification.remove(post); localPostNotification.remove(post); + mentionNotification.remove(post); } /** @@ -881,6 +882,15 @@ public class WebInterface implements CoreListener { public void replyRemoved(PostReply reply) { newReplyNotification.remove(reply); localReplyNotification.remove(reply); + if (!getMentionedSones(reply.getText()).isEmpty()) { + boolean isMentioned = false; + for (PostReply existingReply : getCore().getReplies(reply.getPost())) { + isMentioned |= getCore().isNewReply(reply.getId()) && !getMentionedSones(existingReply.getText()).isEmpty(); + } + if (!isMentioned) { + mentionNotification.remove(reply.getPost()); + } + } } /**