Store when a topic was first set to auto-close and report that amount of time when it closes. And do some refactoring.

This commit is contained in:
Neil Lalonde
2013-06-06 17:04:10 -04:00
parent b758427572
commit a151bfc7ec
7 changed files with 119 additions and 22 deletions

View File

@ -119,8 +119,7 @@ class TopicsController < ApplicationController
raise Discourse::InvalidParameters.new(:auto_close_days) unless params.has_key?(:auto_close_days)
@topic = Topic.where(id: params[:topic_id].to_i).first
guardian.ensure_can_moderate!(@topic)
@topic.auto_close_days = params[:auto_close_days]
@topic.auto_close_user = current_user
@topic.set_auto_close(params[:auto_close_days], current_user)
@topic.save
render nothing: true
end