]> cat aescling's git repositories - mastodon.git/commitdiff
Fix blank screen when trying to copy emoji with a too large file size (#1718)
authorClaire <claire.github-309c@sitedethib.com>
Mon, 14 Mar 2022 16:34:53 +0000 (17:34 +0100)
committerGitHub <noreply@github.com>
Mon, 14 Mar 2022 16:34:53 +0000 (17:34 +0100)
Fixes #1714

app/controllers/admin/custom_emojis_controller.rb
config/locales-glitch/en.yml

index 71efb543e1aef47b75017a4d5a49e67f3bb076cd..47138bf6c1c23f2677972f9e61ab5ea202c4123f 100644 (file)
@@ -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
index 7fd0683c99fb369dc6b89e91c378ed4c16e253dd..3b554f4a2b3d002e87cc06d715dfa752084f83af 100644 (file)
@@ -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