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.
This commit is contained in:
Krzysztof Kotlarek 2021-12-16 13:38:06 +01:00 committed by GitHub
parent 9ac8b70b14
commit a229b2feb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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