import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.PostReply;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.L10nFilter;
private final ListNotification<Post> newPostNotification;
/** The “new reply” notification. */
- private final ListNotification<Reply> newReplyNotification;
+ private final ListNotification<PostReply> newReplyNotification;
/** The invisible “local post” notification. */
private final ListNotification<Post> localPostNotification;
/** The invisible “local reply” notification. */
- private final ListNotification<Reply> localReplyNotification;
+ private final ListNotification<PostReply> localReplyNotification;
/** The “you have been mentioned” notification. */
private final ListNotification<Post> mentionNotification;
localPostNotification = new ListNotification<Post>("local-post-notification", "posts", localPostNotificationTemplate, false);
Template newReplyNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newReplyNotification.html"));
- newReplyNotification = new ListNotification<Reply>("new-reply-notification", "replies", newReplyNotificationTemplate, false);
+ newReplyNotification = new ListNotification<PostReply>("new-reply-notification", "replies", newReplyNotificationTemplate, false);
Template localReplyNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newReplyNotification.html"));
- localReplyNotification = new ListNotification<Reply>("local-reply-notification", "replies", localReplyNotificationTemplate, false);
+ localReplyNotification = new ListNotification<PostReply>("local-reply-notification", "replies", localReplyNotificationTemplate, false);
Template mentionNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/mentionNotification.html"));
mentionNotification = new ListNotification<Post>("mention-notification", "posts", mentionNotificationTemplate, false);
*
* @return The new replies
*/
- public Set<Reply> getNewReplies() {
- return new SetBuilder<Reply>().addAll(newReplyNotification.getElements()).addAll(localReplyNotification.getElements()).get();
+ public Set<PostReply> getNewReplies() {
+ return new SetBuilder<PostReply>().addAll(newReplyNotification.getElements()).addAll(localReplyNotification.getElements()).get();
}
/**
pageToadlets.add(pageToadletFactory.createPageToadlet(new MoveProfileFieldAjaxPage(this)));
ToadletContainer toadletContainer = sonePlugin.pluginRespirator().getToadletContainer();
- toadletContainer.getPageMaker().addNavigationCategory("/Sone/index.html", "Navigation.Menu.Name", "Navigation.Menu.Tooltip", sonePlugin);
+ toadletContainer.getPageMaker().addNavigationCategory("/Sone/index.html", "Navigation.Menu.Sone.Name", "Navigation.Menu.Sone.Tooltip", sonePlugin);
for (PageToadlet toadlet : pageToadlets) {
String menuName = toadlet.getMenuName();
if (menuName != null) {
- toadletContainer.register(toadlet, "Navigation.Menu.Name", toadlet.path(), true, "Navigation.Menu.Item." + menuName + ".Name", "Navigation.Menu.Item." + menuName + ".Tooltip", false, toadlet);
+ toadletContainer.register(toadlet, "Navigation.Menu.Sone.Name", toadlet.path(), true, "Navigation.Menu.Sone.Item." + menuName + ".Name", "Navigation.Menu.Sone.Item." + menuName + ".Tooltip", false, toadlet);
} else {
toadletContainer.register(toadlet, null, toadlet.path(), true, false);
}
for (PageToadlet pageToadlet : pageToadlets) {
toadletContainer.unregister(pageToadlet);
}
- toadletContainer.getPageMaker().removeNavigationCategory("Navigation.Menu.Name");
+ toadletContainer.getPageMaker().removeNavigationCategory("Navigation.Menu.Sone.Name");
}
/**
* {@inheritDoc}
*/
@Override
- public void newReplyFound(Reply reply) {
+ public void newReplyFound(PostReply reply) {
boolean isLocal = getCore().isLocalSone(reply.getSone());
if (isLocal) {
localReplyNotification.add(reply);
}
if (!hasFirstStartNotification()) {
notificationManager.addNotification(isLocal ? localReplyNotification : newReplyNotification);
- if (!getMentionedSones(reply.getText()).isEmpty() && !isLocal && (reply.getPost().getSone() != null)) {
+ if (!getMentionedSones(reply.getText()).isEmpty() && !isLocal && (reply.getPost().getSone() != null) && (reply.getTime() <= System.currentTimeMillis())) {
mentionNotification.add(reply.getPost());
notificationManager.addNotification(mentionNotification);
}
* {@inheritDoc}
*/
@Override
- public void markReplyKnown(Reply reply) {
+ public void markReplyKnown(PostReply reply) {
newReplyNotification.remove(reply);
localReplyNotification.remove(reply);
mentionNotification.remove(reply.getPost());
* {@inheritDoc}
*/
@Override
- public void replyRemoved(Reply reply) {
+ public void replyRemoved(PostReply reply) {
newReplyNotification.remove(reply);
localReplyNotification.remove(reply);
}