diff --git a/app/jobs/regular/publish_topic_to_category.rb b/app/jobs/regular/publish_topic_to_category.rb index fe96de346b6..ab88d5e6ae3 100644 --- a/app/jobs/regular/publish_topic_to_category.rb +++ b/app/jobs/regular/publish_topic_to_category.rb @@ -9,6 +9,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) end end end diff --git a/spec/jobs/publish_topic_to_category_spec.rb b/spec/jobs/publish_topic_to_category_spec.rb index bda35cc3f5e..98226ac6717 100644 --- a/spec/jobs/publish_topic_to_category_spec.rb +++ b/spec/jobs/publish_topic_to_category_spec.rb @@ -38,12 +38,13 @@ RSpec.describe Jobs::PublishTopicToCategory do end it 'should publish the topic to the new category correctly' do - Timecop.travel(1.hour.ago) { topic } + Timecop.travel(1.hour.ago) { topic.update!(visible: false) } described_class.new.execute(topic_status_update_id: topic.topic_status_update.id) topic.reload expect(topic.category).to eq(another_category) + expect(topic.visible).to eq(true) %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)