From c1eb83f20e772ece19a173f26f28c4a810249679 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Feb 2013 06:40:06 +0100 Subject: [PATCH] Remove all post replies of the given Sone before storing the new post replies. --- .../java/net/pterodactylus/sone/database/memory/MemoryDatabase.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java index 2f77eed..6e5546b 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java @@ -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())) { -- 2.7.4