diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb index 68979ad1219c3d..f0b55ce0649f47 100644 --- a/app/controllers/admin/custom_emojis_controller.rb +++ b/app/controllers/admin/custom_emojis_controller.rb @@ -67,7 +67,7 @@ def set_custom_emoji end def resource_params - params.require(:custom_emoji).permit(:shortcode, :image, :visible_in_picker) + params.require(:custom_emoji).permit(:shortcode, :image, :visible_in_picker, :aliases_raw, :license) end def update_params @@ -101,7 +101,7 @@ def action_from_button end def form_custom_emoji_batch_params - params.require(:form_custom_emoji_batch).permit(:action, :category_id, :category_name, :aliases_raw, custom_emoji_ids: []) + params.require(:form_custom_emoji_batch).permit(:action, :category_id, :category_name, custom_emoji_ids: []) end end end diff --git a/app/models/form/custom_emoji_batch.rb b/app/models/form/custom_emoji_batch.rb index 8d646c17cecb26..c63996e06950b2 100644 --- a/app/models/form/custom_emoji_batch.rb +++ b/app/models/form/custom_emoji_batch.rb @@ -6,7 +6,7 @@ class Form::CustomEmojiBatch include AccountableConcern attr_accessor :custom_emoji_ids, :action, :current_account, - :category_id, :category_name, :aliases_raw, :visible_in_picker + :category_id, :category_name, :visible_in_picker def save case action @@ -43,8 +43,7 @@ def update! end custom_emojis.each do |custom_emoji| - new_aliases_raw = (aliases_raw.presence || custom_emoji.aliases_raw) - custom_emoji.update(category_id: category&.id, aliases_raw: new_aliases_raw) + custom_emoji.update(category_id: category&.id) log_action :update, custom_emoji end end diff --git a/app/views/admin/custom_emojis/edit.html.haml b/app/views/admin/custom_emojis/edit.html.haml index c909c1f4f42201..cde13d12e54243 100644 --- a/app/views/admin/custom_emojis/edit.html.haml +++ b/app/views/admin/custom_emojis/edit.html.haml @@ -6,6 +6,9 @@ - CustomEmojiFilter::KEYS.each do |key| = hidden_field_tag key, params[key] if params[key].present? + .fields-group + = custom_emoji_tag(@custom_emoji) + %h4= t('admin.custom_emojis.shortcode') .fields-group diff --git a/app/views/admin/custom_emojis/index.html.haml b/app/views/admin/custom_emojis/index.html.haml index d103ab444548a4..8b4e93ac3594ff 100644 --- a/app/views/admin/custom_emojis/index.html.haml +++ b/app/views/admin/custom_emojis/index.html.haml @@ -75,12 +75,6 @@ .label_input = f.text_field :category_name, class: 'string optional', placeholder: t('admin.custom_emojis.create_new_category'), 'aria-label': t('admin.custom_emojis.create_new_category') - .fields-row - .fields-group.fields-row__column - .input.string.optional - .label_input - = f.text_field :aliases_raw, class: 'string optional', placeholder: 'Alias names', 'aria-label': 'Alias names' - .batch-table__body - if @custom_emojis.empty? = nothing_here 'nothing-here--under-tabs' diff --git a/app/views/admin/custom_emojis/new.html.haml b/app/views/admin/custom_emojis/new.html.haml index 95996dec86164d..e1261e7f50080c 100644 --- a/app/views/admin/custom_emojis/new.html.haml +++ b/app/views/admin/custom_emojis/new.html.haml @@ -6,8 +6,18 @@ .fields-group = f.input :shortcode, wrapper: :with_label, label: t('admin.custom_emojis.shortcode'), hint: t('admin.custom_emojis.shortcode_hint') + .fields-group = f.input :image, wrapper: :with_label, input_html: { accept: CustomEmoji::IMAGE_MIME_TYPES.join(' ') }, hint: t('admin.custom_emojis.image_hint', size: number_to_human_size(CustomEmoji::LIMIT)) + .fields-group + = f.input :visible_in_picker, as: :boolean, wrapper: :with_label, label: t('admin.custom_emojis.visible_in_picker') + + .fields-group + = f.input :aliases_raw, wrapper: :with_label, kmyblue: true, label: t('admin.custom_emojis.aliases'), hint: t('admin.custom_emojis.aliases_hint') + + .fields-group + = f.input :license, wrapper: :with_label, kmyblue: true, label: t('admin.custom_emojis.license'), hint: t('admin.custom_emojis.license_hint') + .actions = f.button :button, t('admin.custom_emojis.upload'), type: :submit