mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 07:43:43 +08:00
Remove like on change of ownership. (#5038)
This commit is contained in:
parent
f2539a86d0
commit
117417848e
|
@ -22,6 +22,7 @@ class PostOwnerChanger
|
|||
end
|
||||
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
|
||||
|
|
|
@ -26,8 +26,12 @@ describe PostOwnerChanger do
|
|||
freeze_time 2.days.from_now
|
||||
|
||||
old_user = p1.user
|
||||
PostAction.act(user_a, p1, PostActionType.types[:like])
|
||||
p1.reload
|
||||
expect(p1.topic.like_count).to eq(1)
|
||||
PostOwnerChanger.new(post_ids: [p1.id], topic_id: topic.id, new_owner: user_a, acting_user: editor).change_owner!
|
||||
p1.reload
|
||||
expect(p1.topic.like_count).to eq(0)
|
||||
expect(p1.topic.bumped_at).to be_within(1.second).of (bumped_at)
|
||||
expect(p1.topic.last_post_user_id).to eq(user_a.id)
|
||||
expect(old_user).not_to eq(p1.user)
|
||||
|
|
Loading…
Reference in New Issue
Block a user