FIX: setting owner on topic should not bump topic
This commit is contained in:
parent
20ce7f29e0
commit
8577b7e2cc
|
@ -439,7 +439,7 @@ class Post < ActiveRecord::Base
|
||||||
new_user: new_user.username_lower
|
new_user: new_user.username_lower
|
||||||
)
|
)
|
||||||
|
|
||||||
revise(actor, { raw: self.raw, user_id: new_user.id, edit_reason: edit_reason })
|
revise(actor, {raw: self.raw, user_id: new_user.id, edit_reason: edit_reason}, bypass_bump: true)
|
||||||
|
|
||||||
if post_number == topic.highest_post_number
|
if post_number == topic.highest_post_number
|
||||||
topic.update_columns(last_post_user_id: new_user.id)
|
topic.update_columns(last_post_user_id: new_user.id)
|
||||||
|
|
|
@ -20,9 +20,12 @@ describe PostOwnerChanger do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "changes the user" do
|
it "changes the user" do
|
||||||
|
bumped_at = topic.bumped_at
|
||||||
|
|
||||||
old_user = p1.user
|
old_user = p1.user
|
||||||
PostOwnerChanger.new(post_ids: [p1.id], topic_id: topic.id, new_owner: user_a, acting_user: editor).change_owner!
|
PostOwnerChanger.new(post_ids: [p1.id], topic_id: topic.id, new_owner: user_a, acting_user: editor).change_owner!
|
||||||
p1.reload
|
p1.reload
|
||||||
|
expect(p1.topic.bumped_at).to eq(bumped_at)
|
||||||
expect(p1.topic.last_post_user_id).to eq(user_a.id)
|
expect(p1.topic.last_post_user_id).to eq(user_a.id)
|
||||||
expect(old_user).not_to eq(p1.user)
|
expect(old_user).not_to eq(p1.user)
|
||||||
expect(p1.user).to eq(user_a)
|
expect(p1.user).to eq(user_a)
|
||||||
|
|
Loading…
Reference in New Issue