/** The “new reply” notification. */
private final ListNotification<Reply> newReplyNotification;
+ /** The invisible “local post” notification. */
+ private final ListNotification<Post> localPostNotification;
+
+ /** The invisible “local reply” notification. */
+ private final ListNotification<Reply> localReplyNotification;
+
/** The “you have been mentioned” notification. */
private final ListNotification<Post> mentionNotification;
Template newPostNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newPostNotification.html"));
newPostNotification = new ListNotification<Post>("new-post-notification", "posts", newPostNotificationTemplate, false);
+ localPostNotification = new ListNotification<Post>("local-post-notification", "posts", newPostNotificationTemplate, false);
Template newReplyNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newReplyNotification.html"));
newReplyNotification = new ListNotification<Reply>("new-reply-notification", "replies", newReplyNotificationTemplate, false);
+ localReplyNotification = new ListNotification<Reply>("local-reply-notification", "replies", newReplyNotificationTemplate, false);
Template mentionNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/mentionNotification.html"));
mentionNotification = new ListNotification<Post>("mention-notification", "posts", mentionNotificationTemplate, false);
*/
@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);
}
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);
}
@Override
public void markPostKnown(Post post) {
newPostNotification.remove(post);
+ localPostNotification.remove(post);
mentionNotification.remove(post);
}
@Override
public void markReplyKnown(Reply reply) {
newReplyNotification.remove(reply);
+ localReplyNotification.remove(reply);
mentionNotification.remove(reply.getPost());
}
@Override
public void postRemoved(Post post) {
newPostNotification.remove(post);
+ localPostNotification.remove(post);
}
/**
@Override
public void replyRemoved(Reply reply) {
newReplyNotification.remove(reply);
+ localReplyNotification.remove(reply);
}
/**