From c618d3a0a557530c85b60870958b1cd7b4320f43 Mon Sep 17 00:00:00 2001 From: prplecake Date: Fri, 14 Oct 2022 17:20:54 -0500 Subject: [PATCH] Make "No $entity selected" errors more accurate (#19356) Previously all controllers would use the single "No accounts changed as none were selected" message. This commit changes them to read "tags", "posts", "emojis", etc. where necessary. --- app/controllers/admin/custom_emojis_controller.rb | 2 +- .../admin/trends/links/preview_card_providers_controller.rb | 2 +- app/controllers/admin/trends/links_controller.rb | 2 +- app/controllers/admin/trends/statuses_controller.rb | 2 +- app/controllers/admin/trends/tags_controller.rb | 2 +- config/locales/en.yml | 6 ++++++ 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb index 2c33e9f8f7d..00d069cdfb0 100644 --- a/app/controllers/admin/custom_emojis_controller.rb +++ b/app/controllers/admin/custom_emojis_controller.rb @@ -34,7 +34,7 @@ module Admin @form = Form::CustomEmojiBatch.new(form_custom_emoji_batch_params.merge(current_account: current_account, action: action_from_button)) @form.save rescue ActionController::ParameterMissing - flash[:alert] = I18n.t('admin.accounts.no_account_selected') + flash[:alert] = I18n.t('admin.custom_emojis.no_emoji_selected') rescue Mastodon::NotPermittedError flash[:alert] = I18n.t('admin.custom_emojis.not_permitted') ensure diff --git a/app/controllers/admin/trends/links/preview_card_providers_controller.rb b/app/controllers/admin/trends/links/preview_card_providers_controller.rb index 97dee8eca44..768b79f8dbc 100644 --- a/app/controllers/admin/trends/links/preview_card_providers_controller.rb +++ b/app/controllers/admin/trends/links/preview_card_providers_controller.rb @@ -14,7 +14,7 @@ class Admin::Trends::Links::PreviewCardProvidersController < Admin::BaseControll @form = Trends::PreviewCardProviderBatch.new(trends_preview_card_provider_batch_params.merge(current_account: current_account, action: action_from_button)) @form.save rescue ActionController::ParameterMissing - flash[:alert] = I18n.t('admin.accounts.no_account_selected') + flash[:alert] = I18n.t('admin.trends.links.publishers.no_publisher_selected') ensure redirect_to admin_trends_links_preview_card_providers_path(filter_params) end diff --git a/app/controllers/admin/trends/links_controller.rb b/app/controllers/admin/trends/links_controller.rb index a3454f2dab0..83d68eba63c 100644 --- a/app/controllers/admin/trends/links_controller.rb +++ b/app/controllers/admin/trends/links_controller.rb @@ -15,7 +15,7 @@ class Admin::Trends::LinksController < Admin::BaseController @form = Trends::PreviewCardBatch.new(trends_preview_card_batch_params.merge(current_account: current_account, action: action_from_button)) @form.save rescue ActionController::ParameterMissing - flash[:alert] = I18n.t('admin.accounts.no_account_selected') + flash[:alert] = I18n.t('admin.trends.links.no_link_selected') ensure redirect_to admin_trends_links_path(filter_params) end diff --git a/app/controllers/admin/trends/statuses_controller.rb b/app/controllers/admin/trends/statuses_controller.rb index 2b8226138f6..004f42b0c3e 100644 --- a/app/controllers/admin/trends/statuses_controller.rb +++ b/app/controllers/admin/trends/statuses_controller.rb @@ -15,7 +15,7 @@ class Admin::Trends::StatusesController < Admin::BaseController @form = Trends::StatusBatch.new(trends_status_batch_params.merge(current_account: current_account, action: action_from_button)) @form.save rescue ActionController::ParameterMissing - flash[:alert] = I18n.t('admin.accounts.no_account_selected') + flash[:alert] = I18n.t('admin.trends.statuses.no_status_selected') ensure redirect_to admin_trends_statuses_path(filter_params) end diff --git a/app/controllers/admin/trends/tags_controller.rb b/app/controllers/admin/trends/tags_controller.rb index 98dd6c8ec22..f5946448ae1 100644 --- a/app/controllers/admin/trends/tags_controller.rb +++ b/app/controllers/admin/trends/tags_controller.rb @@ -14,7 +14,7 @@ class Admin::Trends::TagsController < Admin::BaseController @form = Trends::TagBatch.new(trends_tag_batch_params.merge(current_account: current_account, action: action_from_button)) @form.save rescue ActionController::ParameterMissing - flash[:alert] = I18n.t('admin.accounts.no_account_selected') + flash[:alert] = I18n.t('admin.trends.tags.no_tag_selected') ensure redirect_to admin_trends_tags_path(filter_params) end diff --git a/config/locales/en.yml b/config/locales/en.yml index 11716234ef3..504f1b364db 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -345,6 +345,7 @@ en: listed: Listed new: title: Add new custom emoji + no_emoji_selected: No emojis were changed as none were selected not_permitted: You are not permitted to perform this action overwrite: Overwrite shortcode: Shortcode @@ -813,6 +814,9 @@ en: description_html: These are links that are currently being shared a lot by accounts that your server sees posts from. It can help your users find out what's going on in the world. No links are displayed publicly until you approve the publisher. You can also allow or reject individual links. disallow: Disallow link disallow_provider: Disallow publisher + no_link_selected: No links were changed as none were selected + publishers: + no_publisher_selected: No publishers were changed as none were selected shared_by_over_week: one: Shared by one person over the last week other: Shared by %{count} people over the last week @@ -832,6 +836,7 @@ en: description_html: These are posts that your server knows about that are currently being shared and favourited a lot at the moment. It can help your new and returning users to find more people to follow. No posts are displayed publicly until you approve the author, and the author allows their account to be suggested to others. You can also allow or reject individual posts. disallow: Disallow post disallow_account: Disallow author + no_status_selected: No trending posts were changed as none were selected not_discoverable: Author has not opted-in to being discoverable shared_by: one: Shared or favourited one time @@ -847,6 +852,7 @@ en: tag_uses_measure: total uses description_html: These are hashtags that are currently appearing in a lot of posts that your server sees. It can help your users find out what people are talking the most about at the moment. No hashtags are displayed publicly until you approve them. listable: Can be suggested + no_tag_selected: No tags were changed as none were selected not_listable: Won't be suggested not_trendable: Won't appear under trends not_usable: Cannot be used