mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Allow categories with null position, which means sort them based on activity. Mix absolutely positioned (position is not null) categories with null position categories.
This commit is contained in:
@ -60,7 +60,9 @@ class CategoriesController < ApplicationController
|
||||
def update
|
||||
guardian.ensure_can_edit!(@category)
|
||||
json_result(@category, serializer: CategorySerializer) { |cat|
|
||||
cat.move_to(category_params[:position].to_i) if category_params[:position]
|
||||
if category_params[:position]
|
||||
category_params[:position] == 'default' ? cat.use_default_position : cat.move_to(category_params[:position].to_i)
|
||||
end
|
||||
category_params.delete(:position)
|
||||
cat.update_attributes(category_params)
|
||||
}
|
||||
|
Reference in New Issue
Block a user