From 048746e56b69a7192990ed72be50be465474e46b Mon Sep 17 00:00:00 2001 From: Echo Date: Mon, 1 Dec 2025 15:24:24 +0100 Subject: [PATCH] Hide domain for local emojis in admin (#37080) --- app/controllers/admin/custom_emojis_controller.rb | 9 +++++++++ app/views/admin/custom_emojis/index.html.haml | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb index e3da834fcd..b6fc9ef27c 100644 --- a/app/controllers/admin/custom_emojis_controller.rb +++ b/app/controllers/admin/custom_emojis_controller.rb @@ -5,6 +5,15 @@ module Admin def index authorize :custom_emoji, :index? + # If filtering by local emojis, remove by_domain filter. + params.delete(:by_domain) if params[:local].present? + + # If filtering by domain, ensure remote filter is set. + if params[:by_domain].present? + params.delete(:local) + params[:remote] = '1' + end + @custom_emojis = filtered_custom_emojis.eager_load(:local_counterpart).page(params[:page]) @form = Form::CustomEmojiBatch.new end diff --git a/app/views/admin/custom_emojis/index.html.haml b/app/views/admin/custom_emojis/index.html.haml index b9e11a17d1..b7f2d4f631 100644 --- a/app/views/admin/custom_emojis/index.html.haml +++ b/app/views/admin/custom_emojis/index.html.haml @@ -9,15 +9,15 @@ .filter-subset %strong= t('admin.accounts.location.title') %ul - %li= filter_link_to t('admin.accounts.location.all'), local: nil, remote: nil + %li= filter_link_to t('admin.accounts.location.all'), local: nil, remote: nil, by_domain: nil %li - if selected? local: '1', remote: nil = filter_link_to t('admin.accounts.location.local'), { local: nil, remote: nil }, { local: '1', remote: nil } - else - = filter_link_to t('admin.accounts.location.local'), local: '1', remote: nil + = filter_link_to t('admin.accounts.location.local'), local: '1', remote: nil, by_domain: nil %li - if selected? remote: '1', local: nil - = filter_link_to t('admin.accounts.location.remote'), { remote: nil, local: nil }, { remote: '1', local: nil } + = filter_link_to t('admin.accounts.location.remote'), { remote: nil, local: nil, by_domain: nil }, { remote: '1', local: nil } - else = filter_link_to t('admin.accounts.location.remote'), remote: '1', local: nil @@ -27,6 +27,8 @@ = form.hidden_field key, value: params[key] if params[key].present? - %i(shortcode by_domain).each do |key| + - next if key == :by_domain && params[:local] == '1' + .input.string.optional = form.text_field key, value: params[key],