FIX: Changing the post owner didn't update the reply_to_user_id of replies (#13862)

This commit is contained in:
Gerhard Schlager
2021-07-27 20:49:08 +02:00
committed by GitHub
parent 461cb96532
commit 4a37612fd5
2 changed files with 14 additions and 0 deletions
+11
View File
@@ -235,6 +235,17 @@ describe PostOwnerChanger do
expect(stats[1].action_type).to eq(UserAction::REPLY)
expect(stats[1].count).to eq(1)
end
it "updates reply_to_user_id" do
p4 = Fabricate(:post, topic: topic, reply_to_post_number: p1.post_number, reply_to_user_id: p1.user_id)
p5 = Fabricate(:post, topic: topic, reply_to_post_number: p2.post_number, reply_to_user_id: p2.user_id)
PostOwnerChanger.new(post_ids: [p1.id], topic_id: topic.id, new_owner: user_a, acting_user: editor).change_owner!
p4.reload; p5.reload
expect(p4.reply_to_user_id).to eq(user_a.id)
expect(p5.reply_to_user_id).to eq(p2.user_id)
end
end
end
end