From b65a022ac35535b452d4a5bcf92d0542829ed694 Mon Sep 17 00:00:00 2001 From: KMY Date: Mon, 21 Aug 2023 12:23:42 +0900 Subject: [PATCH] Remove checks with removing list related to antenna --- app/controllers/api/v1/lists_controller.rb | 3 ++- config/locales/en.yml | 1 - config/locales/ja.yml | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/lists_controller.rb b/app/controllers/api/v1/lists_controller.rb index 70145c983a..4071c34799 100644 --- a/app/controllers/api/v1/lists_controller.rb +++ b/app/controllers/api/v1/lists_controller.rb @@ -31,7 +31,8 @@ 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? + antenna = Antenna.find_by(list_id: @list.id) + antenna.update!(list_id: 0) if antenna.present? @list.destroy! render_empty diff --git a/config/locales/en.yml b/config/locales/en.yml index 5530c3e88e..48997bd4bd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1063,7 +1063,6 @@ en: invalid_list_owner: This list is not yours over_limit: You have exceeded the limit of %{limit} antennas over_stl_limit: You have exceeded the limit of %{limit} stl antennas - 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 7ab76e5b92..b0a6b717aa 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1034,7 +1034,6 @@ ja: tags: 登録できるタグ数の上限に達しています over_limit: 所持できるアンテナ数 %{limit}を超えています over_stl_limit: 所持できるSTLモード付きアンテナ数 (ホーム/リストそれぞれにつき%{limit}) を超えています - remove_list_with_antenna: アンテナが関連付けられているリストは削除できません edit: accounts_hint: ローカルアカウントの場合は「@info」、リモートアカウントの場合は「@info@example.com」の形式で指定します。サーバーが認識していないアカウントは保存時に自動的に削除されます。 accounts_raw: 絞り込むアカウント