A platform for community discussion. Free, open, simple.
FIX: PostOwnerChange should update 'topic.last_poser'
Régis Hanolb284464a9104
diff --git a/app/services/post_owner_changer.rb b/app/services/post_owner_changer.rbindex 8d4e261e8b8..df318659dad 100644--- a/app/services/post_owner_changer.rb+++ b/app/services/post_owner_changer.rb@@ -12,21 +12,22 @@ class PostOwnerChangerdef change_owner!@post_ids.each do |post_id|- post = Post.with_deleted.where(id: post_id, topic_id: @topic.id).first- next if post.blank?- @topic.user = @new_owner if post.is_first_post?+ next unless post = Post.with_deleted.find_by(id: post_id, topic_id: @topic.id)- if post.user == nil- @topic.recover! if post.is_first_post?+ if post.is_first_post?+ @topic.user = @new_owner+ @topic.recover! if post.user.nil?end+post.topic = @topicpost.set_owner(@new_owner, @acting_user, @skip_revision)PostAction.remove_act(@new_owner, post, PostActionType.types[:like])- if post.post_number == 1- TopicUser.change(@new_owner.id, @topic.id, notification_level: NotificationLevels.topic_levels[:watching])- else- TopicUser.change(@new_owner.id, @topic.id, notification_level: NotificationLevels.topic_levels[:tracking])+ level = post.is_first_post? ? :watching : :tracking+ TopicUser.change(@new_owner.id, @topic.id, notification_level: NotificationLevels.topic_levels[level])++ if post == @topic.posts.order("post_number DESC").where("NOT hidden AND posts.deleted_at IS NULL").first+ @topic.last_poster = @new_ownerend@topic.update_statistics