X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=75b5f50c9b0f7517c4d0e4bc79a2f91789b18667;hp=00f8cf9c5fe7a1f1c0d0894e232c54651ebdc7a0;hb=refs%2Fheads%2Fnew-database-38;hpb=66b03d16a393c9f02090245ea963d45ce0b4cf79 diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 00f8cf9..75b5f50 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -372,7 +372,7 @@ public class WebInterface implements CoreListener { * currently logged in */ public Sone getCurrentSone(ToadletContext toadletContext, boolean create) { - Set localSones = getCore().getLocalSones(); + Collection localSones = getCore().getLocalSones(); if (localSones.size() == 1) { return localSones.iterator().next(); } @@ -725,8 +725,8 @@ public class WebInterface implements CoreListener { } /** - * Returns all {@link Core#isLocalSone(Sone) local Sone}s that are - * referenced by {@link SonePart}s in the given text (after parsing it using + * Returns all {@link Core#getLocalSones() local Sone}s that are referenced + * by {@link SonePart}s in the given text (after parsing it using * {@link SoneTextParser}). * * @param text @@ -789,15 +789,14 @@ public class WebInterface implements CoreListener { */ @Override public void newPostFound(Post post) { - boolean isLocal = getCore().isLocalSone(post.getSone()); - if (isLocal) { + if (post.getSone().isLocal()) { localPostNotification.add(post); } else { newPostNotification.add(post); } if (!hasFirstStartNotification()) { - notificationManager.addNotification(isLocal ? localPostNotification : newPostNotification); - if (!getMentionedSones(post.getText()).isEmpty() && !isLocal) { + notificationManager.addNotification(post.getSone().isLocal() ? localPostNotification : newPostNotification); + if (!getMentionedSones(post.getText()).isEmpty() && !post.getSone().isLocal()) { mentionNotification.add(post); notificationManager.addNotification(mentionNotification); } @@ -811,15 +810,14 @@ public class WebInterface implements CoreListener { */ @Override public void newReplyFound(PostReply reply) { - boolean isLocal = getCore().isLocalSone(reply.getSone()); - if (isLocal) { + if (reply.getSone().isLocal()) { localReplyNotification.add(reply); } else { newReplyNotification.add(reply); } if (!hasFirstStartNotification()) { - notificationManager.addNotification(isLocal ? localReplyNotification : newReplyNotification); - if (!getMentionedSones(reply.getText()).isEmpty() && !isLocal && (reply.getPost().getSone() != null) && (reply.getTime() <= System.currentTimeMillis())) { + notificationManager.addNotification(reply.getSone().isLocal() ? localReplyNotification : newReplyNotification); + if (!getMentionedSones(reply.getText()).isEmpty() && !reply.getSone().isLocal() && (reply.getPost().getSone() != null) && (reply.getTime() <= System.currentTimeMillis())) { mentionNotification.add(reply.getPost()); notificationManager.addNotification(mentionNotification); }