FIX: update 'posted' column on post owner change (#16367)

Fixes the issue where making a user x as owner of a post doesn't
cause the concerned topic to be listed in new owner's `My Posts`
top menu filter

per https://meta.discourse.org/t/199369
This commit is contained in:
Faizaan Gagan
2022-04-04 22:42:38 +05:30
committed by GitHub
parent 415c4fa72a
commit 1da4b9eeb3
2 changed files with 6 additions and 1 deletions

View File

@@ -28,7 +28,7 @@ class PostOwnerChanger
PostActionDestroyer.destroy(@new_owner, post, :like, skip_delete_check: true)
level = post.is_first_post? ? :watching : :tracking
TopicUser.change(@new_owner.id, @topic.id, notification_level: NotificationLevels.topic_levels[level])
TopicUser.change(@new_owner.id, @topic.id, notification_level: NotificationLevels.topic_levels[level], posted: true)
if post == @topic.posts.order("post_number DESC").where("NOT hidden AND posts.deleted_at IS NULL").first
@topic.last_poster = @new_owner