projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2829164
)
Use different notifications for local elements.
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Sat, 18 Jun 2011 14:23:35 +0000
(16:23 +0200)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Sat, 18 Jun 2011 14:23:35 +0000
(16:23 +0200)
src/main/java/net/pterodactylus/sone/web/WebInterface.java
patch
|
blob
|
history
src/main/resources/static/css/sone.css
patch
|
blob
|
history
src/main/resources/static/javascript/sone.js
patch
|
blob
|
history
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
(file)
--- 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<Reply> newReplyNotification;
/** 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;
/** The “you have been mentioned” notification. */
private final ListNotification<Post> mentionNotification;
@@
-235,9
+241,11
@@
public class WebInterface implements CoreListener {
Template newPostNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newPostNotification.html"));
newPostNotification = new ListNotification<Post>("new-post-notification", "posts", newPostNotificationTemplate, false);
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);
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);
Template mentionNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/mentionNotification.html"));
mentionNotification = new ListNotification<Post>("mention-notification", "posts", mentionNotificationTemplate, false);
@@
-731,10
+739,15
@@
public class WebInterface implements CoreListener {
*/
@Override
public void newPostFound(Post post) {
*/
@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()) {
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);
}
mentionNotification.add(post);
notificationManager.addNotification(mentionNotification);
}
@@
-751,10
+764,15
@@
public class WebInterface implements CoreListener {
if (reply.getPost().getSone() == null) {
return;
}
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()) {
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);
}
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);
@Override
public void markPostKnown(Post post) {
newPostNotification.remove(post);
+ localPostNotification.remove(post);
mentionNotification.remove(post);
}
mentionNotification.remove(post);
}
@@
-786,6
+805,7
@@
public class WebInterface implements CoreListener {
@Override
public void markReplyKnown(Reply reply) {
newReplyNotification.remove(reply);
@Override
public void markReplyKnown(Reply reply) {
newReplyNotification.remove(reply);
+ localReplyNotification.remove(reply);
mentionNotification.remove(reply.getPost());
}
mentionNotification.remove(reply.getPost());
}
@@
-803,6
+823,7
@@
public class WebInterface implements CoreListener {
@Override
public void postRemoved(Post post) {
newPostNotification.remove(post);
@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);
@Override
public void replyRemoved(Reply reply) {
newReplyNotification.remove(reply);
+ localReplyNotification.remove(reply);
}
/**
}
/**
diff --git
a/src/main/resources/static/css/sone.css
b/src/main/resources/static/css/sone.css
index
c0a7b6d
..
ae38d7d
100644
(file)
--- a/
src/main/resources/static/css/sone.css
+++ b/
src/main/resources/static/css/sone.css
@@
-143,6
+143,10
@@
textarea {
display: none;
}
display: none;
}
+#sone #notification-area #local-post-notification, #sone #notification-area #local-reply-notification {
+ display: none;
+}
+
#sone #plugin-warning {
border: solid 0.5em red;
padding: 0.5em;
#sone #plugin-warning {
border: solid 0.5em red;
padding: 0.5em;
diff --git
a/src/main/resources/static/javascript/sone.js
b/src/main/resources/static/javascript/sone.js
index
0cc6480
..
dd33308
100644
(file)
--- a/
src/main/resources/static/javascript/sone.js
+++ b/
src/main/resources/static/javascript/sone.js
@@
-1079,8
+1079,10
@@
function loadNotifications(notificationIds) {
oldNotification.replaceWith(notification.show());
} else {
$("#sone #notification-area").append(notification);
oldNotification.replaceWith(notification.show());
} else {
$("#sone #notification-area").append(notification);
- notification.slideDown();
- setActivity();
+ if (value.id.substring(0, 5) != "local") {
+ notification.slideDown();
+ setActivity();
+ }
}
});
});
}
});
});