FIX: Topic status update not being deleted once it has been executed.

This commit is contained in:
Guo Xiang Tan 2017-04-11 10:31:11 +08:00
parent 2be14a604c
commit aadf4805a5
2 changed files with 2 additions and 0 deletions

View File

@ -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)

View File

@ -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)