diff --git a/app/services/topic_timestamp_changer.rb b/app/services/topic_timestamp_changer.rb index d02cda99f48..a8d5059c4d2 100644 --- a/app/services/topic_timestamp_changer.rb +++ b/app/services/topic_timestamp_changer.rb @@ -29,6 +29,7 @@ class TopicTimestampChanger end end + @topic.reset_bumped_at update_topic(last_posted_at) yield(@topic) if block_given? @@ -48,7 +49,6 @@ class TopicTimestampChanger @topic.update( created_at: @timestamp, updated_at: @timestamp, - bumped_at: @timestamp, last_posted_at: last_posted_at ) end diff --git a/spec/services/topic_timestamp_changer_spec.rb b/spec/services/topic_timestamp_changer_spec.rb index c94cecfb921..255530f68ca 100644 --- a/spec/services/topic_timestamp_changer_spec.rb +++ b/spec/services/topic_timestamp_changer_spec.rb @@ -26,19 +26,20 @@ describe TopicTimestampChanger do TopicTimestampChanger.new(topic: topic, timestamp: new_timestamp.to_f).change! topic.reload + p1.reload + p2.reload + last_post_created_at = p2.created_at + expect(topic.created_at).to eq_time(new_timestamp) expect(topic.updated_at).to eq_time(new_timestamp) - expect(topic.bumped_at).to eq_time(new_timestamp) + expect(topic.bumped_at).to eq_time(last_post_created_at) + expect(topic.last_posted_at).to eq_time(last_post_created_at) - p1.reload expect(p1.created_at).to eq_time(new_timestamp) expect(p1.updated_at).to eq_time(new_timestamp) - p2.reload expect(p2.created_at).to eq_time(new_timestamp + 1.day) expect(p2.updated_at).to eq_time(new_timestamp + 1.day) - - expect(topic.last_posted_at).to eq_time(p2.reload.created_at) end describe 'when posts have timestamps in the future' do