Merge branch 'next' into new-database-38
[Sone.git] / src / main / java / net / pterodactylus / sone / web / WebInterface.java
index c2bb1c8..b5f6dfb 100644 (file)
@@ -380,7 +380,7 @@ public class WebInterface implements CoreListener {
         *         currently logged in
         */
        public Sone getCurrentSone(ToadletContext toadletContext, boolean create) {
-               Set<Sone> localSones = getCore().getLocalSones();
+               Collection<Sone> localSones = getCore().getLocalSones();
                if (localSones.size() == 1) {
                        return localSones.iterator().next();
                }
@@ -733,8 +733,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
@@ -797,15 +797,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);
                        }
@@ -819,15 +818,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);
                        }