about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-12-18 16:56:59 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-12-18 16:56:59 +0100
commitc0ed53b810351b61db543701c4938d41723a6e4e (patch)
tree1ec586b78987bdc50d1bbbeac1f4521d3583e555 /app
parentfb9137752a734caa6891637728cc243d79c1af97 (diff)
Fix custom emoji category creation silently erroring out on duplicate category (#12647)
Instead, just re-use the existing category if any.

Fixes #12608
Diffstat (limited to 'app')
-rw-r--r--app/models/form/custom_emoji_batch.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/form/custom_emoji_batch.rb b/app/models/form/custom_emoji_batch.rb
index 076e8c9e3..6b7ea5355 100644
--- a/app/models/form/custom_emoji_batch.rb
+++ b/app/models/form/custom_emoji_batch.rb
@@ -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