diff --git a/app/models/post_mover.rb b/app/models/post_mover.rb index 75e3cb16768..79393fbf5db 100644 --- a/app/models/post_mover.rb +++ b/app/models/post_mover.rb @@ -96,6 +96,7 @@ class PostMover via_email: post.via_email, raw_email: post.raw_email, skip_validations: true, + created_at: post.created_at, guardian: Guardian.new(user) ) diff --git a/spec/models/post_mover_spec.rb b/spec/models/post_mover_spec.rb index d483b354fa3..ded0639fca4 100644 --- a/spec/models/post_mover_spec.rb +++ b/spec/models/post_mover_spec.rb @@ -23,7 +23,7 @@ describe PostMover do let(:another_user) { Fabricate(:evil_trout) } let(:category) { Fabricate(:category, user: user) } let!(:topic) { Fabricate(:topic, user: user) } - let!(:p1) { Fabricate(:post, topic: topic, user: user) } + let!(:p1) { Fabricate(:post, topic: topic, user: user, created_at: 3.hours.ago) } let!(:p2) do Fabricate(:post, @@ -401,6 +401,7 @@ describe PostMover do # New first post new_first = new_topic.posts.where(post_number: 1).first expect(new_first.reply_count).to eq(1) + expect(new_first.created_at).to be_within(1.second).of(p1.created_at) # Second post is in a new topic p2.reload