From fe68b6cc889fe997909748b9662672d3c346a4bd Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Fri, 25 May 2018 16:40:00 +0800 Subject: [PATCH] FIX: Don't unassign topic on flag reviewed if topic has been deleted. * Should have a test for this. --- plugin.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index c259380..954ad10 100644 --- a/plugin.rb +++ b/plugin.rb @@ -215,7 +215,8 @@ after_initialize do # 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 + post.topic && + FlagQuery.flagged_post_actions(topic_id: post.topic.id).count == 0 assigner = ::TopicAssigner.new(post.topic, Discourse.system_user) assigner.unassign