mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Moderator actions and small actions shouldn't prevent fully merged topics from closing (#13200)
When a topic is fully merged into another topic we close it and schedule its deleting. But, because of a bug, if the merged topic contains some moderator actions or small actions it won't be merged. This change fixes this problem. An important note: in general, we don't want to close a topic after moving posts if it still contains some regular posts or whispers. But when we are moving posts to a private message we don't want the notice about it to be publicly visible. So we use whispers with action_code == 'split_topic' instead of small_actions in such cases and we should ignore this specific kind of whispers when decide if we should close the merged topic.
This commit is contained in:
committed by
GitHub
parent
d9484db718
commit
b7b8f5e6f3
@@ -66,8 +66,6 @@ class PostMover
|
||||
Guardian.new(user).ensure_can_see! topic
|
||||
@destination_topic = topic
|
||||
|
||||
moving_all_posts = (@original_topic.posts.pluck(:id).sort == @post_ids.sort)
|
||||
|
||||
create_temp_table
|
||||
delete_invalid_post_timings
|
||||
move_each_post
|
||||
@@ -78,7 +76,11 @@ class PostMover
|
||||
update_upload_security_status
|
||||
update_bookmarks
|
||||
|
||||
if moving_all_posts
|
||||
posts_left = @original_topic.posts
|
||||
.where("post_type = ? or (post_type = ? and action_code != 'split_topic')", Post.types[:regular], Post.types[:whisper])
|
||||
.count
|
||||
|
||||
if posts_left == 1
|
||||
close_topic_and_schedule_deletion
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user