From 8f8e0ec88c8c87746f12a157b18dc5983c834c5b Mon Sep 17 00:00:00 2001 From: KMY Date: Wed, 26 Apr 2023 11:30:36 +0900 Subject: [PATCH] Fix removing list with antenna --- app/controllers/api/v1/lists_controller.rb | 1 + config/locales/en.yml | 1 + config/locales/ja.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/app/controllers/api/v1/lists_controller.rb b/app/controllers/api/v1/lists_controller.rb index 843ca2ec2b..3c78862736 100644 --- a/app/controllers/api/v1/lists_controller.rb +++ b/app/controllers/api/v1/lists_controller.rb @@ -31,6 +31,7 @@ class Api::V1::ListsController < Api::BaseController end def destroy + raise Mastodon::ValidationError, I18n.t('antennas.errors.remove_list_with_antenna') if Antenna.where(list_id: @list.id).any? @list.destroy! render_empty end diff --git a/config/locales/en.yml b/config/locales/en.yml index efadfb8e92..adf772e152 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -994,6 +994,7 @@ en: empty_contexts: No contexts! You must set any context filters invalid_context: None or invalid context supplied invalid_list_owner: This list is not yours + remove_list_with_antenna: Cannot remove list because this list is related to antenna. index: contexts: Antennas in %{contexts} delete: Delete diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 1457dedab2..1e97eabbf6 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -950,6 +950,7 @@ ja: errors: empty_contexts: 絞り込み条件が1つも指定されていないため無効です(除外条件はカウントされません) invalid_list_owner: これはあなたのリストではありません + remove_list_with_antenna: アンテナが関連付けられているリストは削除できません edit: accounts_hint: ローカルアカウントの場合は「@info」、リモートアカウントの場合は「@info@example.com」の形式で指定します。サーバーが認識していないアカウントは保存時に自動的に削除されます。 accounts_raw: 絞り込むアカウント