FIX: properly unassign topics if there are no **more** flags to handle

This commit is contained in:
Régis Hanol 2018-08-14 18:20:00 +02:00
parent 7c8ce7d1b3
commit 5800f768f5
1 changed files with 2 additions and 1 deletions

View File

@ -217,7 +217,8 @@ after_initialize do
on(:flag_reviewed) do |post| on(:flag_reviewed) do |post|
if SiteSetting.assign_locks_flags? && if SiteSetting.assign_locks_flags? &&
post.topic && 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 = ::TopicAssigner.new(post.topic, Discourse.system_user)
assigner.unassign assigner.unassign