From 5800f768f555c0262b1428271fd43c332bd484ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 14 Aug 2018 18:20:00 +0200 Subject: [PATCH] FIX: properly unassign topics if there are no **more** flags to handle --- plugin.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 38a59ca..65db180 100644 --- a/plugin.rb +++ b/plugin.rb @@ -217,7 +217,8 @@ after_initialize do on(:flag_reviewed) do |post| if SiteSetting.assign_locks_flags? && post.topic && - FlagQuery.flagged_post_actions(topic_id: post.topic.id).count == 0 + FlagQuery.flagged_post_actions(topic_id: post.topic_id, filter: "old").count > 0 && + FlagQuery.flagged_post_actions(topic_id: post.topic_id).count == 0 assigner = ::TopicAssigner.new(post.topic, Discourse.system_user) assigner.unassign