FIX: don't 'return' in 'flag_reviewed' block

This commit is contained in:
Régis Hanol 2019-05-15 12:50:52 +02:00 committed by GitHub
parent 4b7a99f017
commit 615ad7c5c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -262,15 +262,13 @@ after_initialize do
# Unassign if there are no more flags in the topic
on(:flag_reviewed) do |post|
return if reviewable_api_enabled
if SiteSetting.assign_locks_flags? &&
if !reviewable_api_enabled &&
SiteSetting.assign_locks_flags? &&
post.topic &&
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
::TopicAssigner.new(post.topic, Discourse.system_user).unassign
end
end