If an auto-closing topic is manually closed, remove the auto-close countdown

This commit is contained in:
Neil Lalonde
2013-07-03 16:44:45 -04:00
parent 44cd5505d3
commit 2c8ed8414c
3 changed files with 20 additions and 6 deletions

View File

@ -138,7 +138,7 @@ class Topic < ActiveRecord::Base
before_save do
if (auto_close_at_changed? and !auto_close_at_was.nil?) or (auto_close_user_id_changed? and auto_close_at)
self.auto_close_started_at ||= Time.zone.now
self.auto_close_started_at ||= Time.zone.now if auto_close_at
Jobs.cancel_scheduled_job(:close_topic, {topic_id: id})
true
end