From a229b2feb1b41ea1c206387fe6b3058ba194dce4 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Thu, 16 Dec 2021 13:38:06 +0100 Subject: [PATCH] FIX: always unassign posts when deleted (#270) Post should be always unassigned when deleted. They are hidden, and it may cause a lot of confusion. For example, when a user wants to assign topic, and it cannot be done because existing assignment to deleted post. --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index bef9d7d..17f8ab7 100644 --- a/plugin.rb +++ b/plugin.rb @@ -724,7 +724,7 @@ after_initialize do end on(:post_destroyed) do |post| - if SiteSetting.unassign_on_close && Assignment.exists?(target_type: "Post", target_id: post.id, active: true) + if Assignment.exists?(target_type: "Post", target_id: post.id, active: true) Assignment.where(target_type: "Post", target_id: post.id).update_all(active: false) MessageBus.publish("/topic/#{post.topic_id}", reload_topic: true, refresh_stream: true) end