A platform for community discussion. Free, open, simple.
FIX: when updating timestamps on topic set a correct bump date (#13746)
Andrei Prigorshnevc4d7545f3565
diff --git a/app/services/topic_timestamp_changer.rb b/app/services/topic_timestamp_changer.rbindex d02cda99f48..a8d5059c4d2 100644--- a/app/services/topic_timestamp_changer.rb+++ b/app/services/topic_timestamp_changer.rb@@ -29,6 +29,7 @@ class TopicTimestampChangerendend+ @topic.reset_bumped_atupdate_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)enddiff --git a/spec/services/topic_timestamp_changer_spec.rb b/spec/services/topic_timestamp_changer_spec.rbindex 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 doTopicTimestampChanger.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.reloadexpect(p1.created_at).to eq_time(new_timestamp)expect(p1.updated_at).to eq_time(new_timestamp)- p2.reloadexpect(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)enddescribe 'when posts have timestamps in the future' do