Remove all post replies of the given Sone before storing the new post replies.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Feb 2013 05:40:06 +0000 (06:40 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Feb 2013 05:40:06 +0000 (06:40 +0100)
src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java

index 2f77eed..6e5546b 100644 (file)
@@ -377,6 +377,10 @@ public class MemoryDatabase extends AbstractService implements Database {
 
                lock.writeLock().lock();
                try {
+                       /* remove all post replies of the Sone. */
+                       for (PostReply postReply : getRepliesFrom(sone.getId())) {
+                               removePostReply(postReply);
+                       }
                        for (PostReply postReply : postReplies) {
                                allPostReplies.put(postReply.getId(), postReply);
                                if (this.postReplies.containsKey(postReply.getPostId())) {