From 942de287c6f4862b03b1081fc7181fe9c75d4297 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 16 Oct 2019 14:21:50 +0100 Subject: [PATCH] only remove from index if no more files have the same comment --- .../src/main/groovy/com/muwire/core/files/FileManager.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/groovy/com/muwire/core/files/FileManager.groovy b/core/src/main/groovy/com/muwire/core/files/FileManager.groovy index d989739e..0c1297ef 100644 --- a/core/src/main/groovy/com/muwire/core/files/FileManager.groovy +++ b/core/src/main/groovy/com/muwire/core/files/FileManager.groovy @@ -119,11 +119,12 @@ class FileManager { void onUICommentEvent(UICommentEvent e) { if (e.oldComment != null) { def comment = DataUtil.readi18nString(Base64.decode(e.oldComment)) - index.remove(comment) Set existingFiles = commentToFile.get(comment) existingFiles.remove(e.sharedFile.getFile()) - if (existingFiles.isEmpty()) + if (existingFiles.isEmpty()) { commentToFile.remove(comment) + index.remove(comment) + } } String comment = e.sharedFile.getComment()