mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 04:34:13 -06:00
BugFix: email-in on categories wasn't null-ed properly
Causing a problem if two categories got saved with an empty string because the corresponding Database constraint on the index would complain about dublicate values
This commit is contained in:
parent
23aa478473
commit
bf77c84095
@ -60,6 +60,10 @@ class CategoriesController < ApplicationController
|
|||||||
if category_params[:position]
|
if category_params[:position]
|
||||||
category_params[:position] == 'default' ? cat.use_default_position : cat.move_to(category_params[:position].to_i)
|
category_params[:position] == 'default' ? cat.use_default_position : cat.move_to(category_params[:position].to_i)
|
||||||
end
|
end
|
||||||
|
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)
|
category_params.delete(:position)
|
||||||
cat.update_attributes(category_params)
|
cat.update_attributes(category_params)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user