From c49ddde4c980f4fb7c3cb7c98aedc52a1706960e Mon Sep 17 00:00:00 2001 From: Andy Klimczak Date: Sun, 3 Jul 2016 22:27:45 -0400 Subject: [PATCH] Change the repliesTo for post from list -> set. This removes the bug when a post seems to have more replies than it should due to people quoting the post number more than once in their post. This also fixes the bug where the post1 that quotes post2 multiple times, post1 shows up in the list of replies for post2 multiple times. --- .../src/main/java/org/floens/chan/core/model/Post.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Clover/app/src/main/java/org/floens/chan/core/model/Post.java b/Clover/app/src/main/java/org/floens/chan/core/model/Post.java index 76a0a483..985975df 100644 --- a/Clover/app/src/main/java/org/floens/chan/core/model/Post.java +++ b/Clover/app/src/main/java/org/floens/chan/core/model/Post.java @@ -29,6 +29,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; +import java.util.Set; +import java.util.TreeSet; import java.util.concurrent.atomic.AtomicBoolean; /** @@ -104,9 +106,9 @@ public class Post { /** - * This post replies to the these ids. Is an unmodifiable list after finish(). + * This post replies to the these ids. Is an unmodifiable set after finish(). */ - public List repliesTo = new ArrayList<>(); + public Set repliesTo = new TreeSet<>(); public final ArrayList linkables = new ArrayList<>(); @@ -182,7 +184,7 @@ public class Post { ChanParser.getInstance().parse(this); - repliesTo = Collections.unmodifiableList(repliesTo); + repliesTo = Collections.unmodifiableSet(repliesTo); return true; }