mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 04:07:27 +00:00
FIX: When re-opening a topic that auto-closed, make sure it won't auto-close again
This commit is contained in:
parent
c2f0bdcf49
commit
c35af5d755
@ -22,7 +22,7 @@ TopicStatusUpdate = Struct.new(:topic, :user) do
|
||||
topic.update_column status.name, status.enabled?
|
||||
end
|
||||
|
||||
if status.manually_closing_topic? && topic.auto_close_at
|
||||
if topic.auto_close_at && (status.reopening_topic? || status.manually_closing_topic?)
|
||||
topic.reload.set_auto_close(nil).save
|
||||
end
|
||||
|
||||
|
@ -87,6 +87,14 @@ describe Topic do
|
||||
Then { scheduled_jobs_for(:close_topic).should have(2).jobs }
|
||||
end
|
||||
end
|
||||
|
||||
context 'a topic that has been auto-closed' do
|
||||
Given(:admin) { Fabricate(:admin) }
|
||||
Given!(:auto_closed_topic) { Fabricate(:topic, user: admin, closed: true, auto_close_at: 1.day.ago, auto_close_user_id: admin.id, auto_close_started_at: 6.days.ago) }
|
||||
When { auto_closed_topic.update_status('closed', false, admin) }
|
||||
Then { auto_closed_topic.reload.auto_close_at.should be_nil }
|
||||
And { auto_closed_topic.auto_close_started_at.should be_nil }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user