FIX: Sidekiq job has wrong data when post owner changes within transaction

This commit is contained in:
Gerhard Schlager 2018-02-28 23:31:44 +01:00
parent 79590e4bec
commit 80e85e0d8f
1 changed files with 9 additions and 11 deletions

View File

@ -11,7 +11,6 @@ class PostOwnerChanger
end
def change_owner!
ActiveRecord::Base.transaction do
@post_ids.each do |post_id|
post = Post.with_deleted.where(id: post_id, topic_id: @topic.id).first
next if post.blank?
@ -23,7 +22,6 @@ class PostOwnerChanger
post.topic = @topic
post.set_owner(@new_owner, @acting_user, @skip_revision)
PostAction.remove_act(@new_owner, post, PostActionType.types[:like])
end
@topic.update_statistics