FIX: Category description topics shouldn't auto-close

This commit is contained in:
Neil Lalonde
2013-12-04 10:31:25 -05:00
parent df7b24b14a
commit abed146cc7
4 changed files with 23 additions and 1 deletions
+1
View File
@@ -151,6 +151,7 @@ SQL
def create_category_definition
t = Topic.new(title: I18n.t("category.topic_prefix", category: name), user: user, pinned_at: Time.now, category_id: id)
t.skip_callbacks = true
t.auto_close_days = nil
t.save!
update_column(:topic_id, t.id)
t.posts.create(raw: post_template, user: user)
+1 -1
View File
@@ -605,7 +605,7 @@ class Topic < ActiveRecord::Base
# TODO: change this method, along with category's auto_close_days. Use hours.
def auto_close_days=(num_days)
@ignore_category_auto_close = true
set_auto_close(num_days * 24)
set_auto_close( num_days ? num_days * 24 : nil)
end
def self.auto_close