FIX: Unassign topics if there are no more flags to handle

This commit is contained in:
Robin Ward 2018-02-26 16:15:22 -05:00
parent 4b91799bed
commit 8ee1cbd697
1 changed files with 10 additions and 0 deletions

View File

@ -206,6 +206,16 @@ after_initialize do
end
end
# Unassign if there are no more flags in the topic
on(:flag_reviewed) do |post|
if SiteSetting.assign_locks_flags? &&
FlagQuery.flagged_post_actions(topic_id: post.topic_id).count == 0
assigner = ::TopicAssigner.new(post.topic, Discourse.system_user)
assigner.unassign
end
end
on(:move_to_inbox) do |info|
if SiteSetting.unassign_on_group_archive && info[:group]
if topic = info[:topic]