From aadf4805a539425021dff8352cc4aa404c4159f0 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 11 Apr 2017 10:31:11 +0800 Subject: [PATCH] FIX: Topic status update not being deleted once it has been executed. --- app/jobs/regular/publish_topic_to_category.rb | 1 + spec/jobs/publish_topic_to_category_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/jobs/regular/publish_topic_to_category.rb b/app/jobs/regular/publish_topic_to_category.rb index 11424dd32f0..31a838a2c85 100644 --- a/app/jobs/regular/publish_topic_to_category.rb +++ b/app/jobs/regular/publish_topic_to_category.rb @@ -10,6 +10,7 @@ module Jobs PostTimestampChanger.new(timestamp: Time.zone.now, topic: topic).change! do topic.change_category_to_id(topic_status_update.category_id) topic.update_columns(visible: true) + topic_status_update.trash!(Discourse.system_user) end MessageBus.publish("/topic/#{topic.id}", reload_topic: true, refresh_stream: true) diff --git a/spec/jobs/publish_topic_to_category_spec.rb b/spec/jobs/publish_topic_to_category_spec.rb index e628d719987..e49a3190979 100644 --- a/spec/jobs/publish_topic_to_category_spec.rb +++ b/spec/jobs/publish_topic_to_category_spec.rb @@ -47,6 +47,7 @@ RSpec.describe Jobs::PublishTopicToCategory do topic.reload expect(topic.category).to eq(another_category) expect(topic.visible).to eq(true) + expect(TopicStatusUpdate.find_by(id: topic.topic_status_update.id)).to eq(nil) %w{created_at bumped_at updated_at last_posted_at}.each do |attribute| expect(topic.public_send(attribute)).to be_within(1.second).of(Time.zone.now)