FEATURE: auto-close topics based on last post

This commit is contained in:
Régis Hanol
2014-10-10 18:21:44 +02:00
parent ac72b0bcf6
commit 5754e8dd0f
28 changed files with 242 additions and 146 deletions

View File

@ -75,15 +75,20 @@ class CategoriesController < ApplicationController
def update
guardian.ensure_can_edit!(@category)
json_result(@category, serializer: CategorySerializer) { |cat|
json_result(@category, serializer: CategorySerializer) do |cat|
cat.move_to(category_params[:position].to_i) if category_params[:position]
if category_params.key? :email_in and category_params[:email_in].length == 0
# properly null the value so the database constrain doesn't catch us
category_params[:email_in] = nil
end
category_params.delete(:position)
cat.update_attributes(category_params)
}
end
end
def set_notifications
@ -125,6 +130,7 @@ class CategoriesController < ApplicationController
:email_in_allow_strangers,
:parent_category_id,
:auto_close_hours,
:auto_close_based_on_last_post,
:logo_url,
:background_url,
:allow_badges,