mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 01:05:47 +08:00
FIX: Publish topic to a category should unlist it as well.
This commit is contained in:
parent
708f65f740
commit
48a9860f07
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user