about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-03-14 17:34:53 +0100
committerGitHub <noreply@github.com>2022-03-14 17:34:53 +0100
commit80c4db160ecfd201cb82ed320cbe3eb32236ad20 (patch)
tree2121840d15230e64af66761ac62b1e65938e211b
parent76d6fe63c3a4a68bb26eb8eeea35e52207e35cbc (diff)
Fix blank screen when trying to copy emoji with a too large file size (#1718)
Fixes #1714
-rw-r--r--app/controllers/admin/custom_emojis_controller.rb3
-rw-r--r--config/locales-glitch/en.yml3
2 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb
index 71efb543e..47138bf6c 100644
--- a/app/controllers/admin/custom_emojis_controller.rb
+++ b/app/controllers/admin/custom_emojis_controller.rb
@@ -35,6 +35,9 @@ module Admin
       flash[:alert] = I18n.t('admin.accounts.no_account_selected')
     rescue Mastodon::NotPermittedError
       flash[:alert] = I18n.t('admin.custom_emojis.not_permitted')
+    rescue ActiveRecord::RecordInvalid => e
+      error_message = action_from_button == 'copy' ? 'admin.custom_emojis.batch_copy_error' : 'admin.custom_emojis.batch_error'
+      flash[:alert] = I18n.t(error_message, message: e.message)
     ensure
       redirect_to admin_custom_emojis_path(filter_params)
     end
diff --git a/config/locales-glitch/en.yml b/config/locales-glitch/en.yml
index 7fd0683c9..3b554f4a2 100644
--- a/config/locales-glitch/en.yml
+++ b/config/locales-glitch/en.yml
@@ -1,6 +1,9 @@
 ---
 en:
   admin:
+    custom_emojis:
+      batch_copy_error: 'An error occurred when copying some of the selected emoji: %{message}'
+      batch_error: 'An error occurred: %{message}'
     settings:
       captcha_enabled:
         desc_html: This relies on external scripts from hCaptcha, which may be a security and privacy concern. In addition, <strong>this can make the registration process significantly less accessible to some (especially disabled) people</strong>. For these reasons, please consider alternative measures such as approval-based or invite-based registration.<br>Users that have been invited through a limited-use invite will not need to solve a CAPTCHA