Don’t check for non-existing Sone-following times on your own posts/replies
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 12 Feb 2019 14:39:51 +0000 (15:39 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 12 Feb 2019 15:02:02 +0000 (16:02 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java

index 1601606..4319d8b 100644 (file)
@@ -859,7 +859,9 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                soneChangeDetector.onNewPosts(new PostProcessor() {
                        @Override
                        public void processPost(Post post) {
-                               if (post.getTime() < database.getFollowingTime(newSone.getId())) {
+                               if (post.getSone().equals(newSone)) {
+                                       post.setKnown(true);
+                               } else if (post.getTime() < database.getFollowingTime(newSone.getId())) {
                                        post.setKnown(true);
                                } else if (!post.isKnown()) {
                                        events.add(new NewPostFoundEvent(post));
@@ -875,7 +877,9 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                soneChangeDetector.onNewPostReplies(new PostReplyProcessor() {
                        @Override
                        public void processPostReply(PostReply postReply) {
-                               if (postReply.getTime() < database.getFollowingTime(newSone.getId())) {
+                               if (postReply.getSone().equals(newSone)) {
+                                       postReply.setKnown(true);
+                               } else if (postReply.getTime() < database.getFollowingTime(newSone.getId())) {
                                        postReply.setKnown(true);
                                } else if (!postReply.isKnown()) {
                                        events.add(new NewPostReplyFoundEvent(postReply));