Fix custom emoji category creation silently erroring out on duplicate category (#12647)

Instead, just re-use the existing category if any.

Fixes #12608
lolsob-rspec
ThibG 2019-12-18 16:56:59 +01:00 committed by Eugen Rochko
parent 069718f6d6
commit ec3758bf82
1 changed files with 1 additions and 1 deletions

View File

@ -40,7 +40,7 @@ class Form::CustomEmojiBatch
if category_id.present?
CustomEmojiCategory.find(category_id)
elsif category_name.present?
CustomEmojiCategory.create!(name: category_name)
CustomEmojiCategory.find_or_create_by!(name: category_name)
end
end