diff --git a/app/models/antenna.rb b/app/models/antenna.rb index 51a71cb763..38bf04b7b4 100644 --- a/app/models/antenna.rb +++ b/app/models/antenna.rb @@ -220,7 +220,7 @@ class Antenna < ApplicationRecord private def validate_limit - errors.add(:base, I18n.t('scheduled_statuses.over_total_limit', limit: LIMIT)) if account.antennas.count >= LIMIT + errors.add(:base, I18n.t('antennas.errors.over_limit', limit: LIMIT)) if account.antennas.count >= LIMIT end def validate_stl_limit @@ -228,6 +228,6 @@ class Antenna < ApplicationRecord stls = account.antennas.where(stl: true).where.not(id: id) - errors.add(:base, I18n.t('scheduled_statuses.over_total_limit', limit: LIMIT)) if list_id.zero? ? stls.any? { |tl| tl.list_id.zero? } : stls.any? { |tl| tl.list_id != 0 } + errors.add(:base, I18n.t('antennas.errors.over_stl_limit', limit: 1)) if list_id.zero? ? stls.any? { |tl| tl.list_id.zero? } : stls.any? { |tl| tl.list_id != 0 } end end diff --git a/app/views/antennas/edit.html.haml b/app/views/antennas/edit.html.haml index 7452df8e40..ba3e4f368d 100644 --- a/app/views/antennas/edit.html.haml +++ b/app/views/antennas/edit.html.haml @@ -2,6 +2,7 @@ = t('antennas.edit.title') = simple_form_for @antenna, url: antenna_path(@antenna), method: :put do |f| + = render 'shared/error_messages', object: @antenna = render 'antenna_fields', f: f, lists: @lists .actions diff --git a/app/views/antennas/new.html.haml b/app/views/antennas/new.html.haml index c53c7bc002..9ff46b253c 100644 --- a/app/views/antennas/new.html.haml +++ b/app/views/antennas/new.html.haml @@ -2,6 +2,7 @@ = t('antennas.new.title') = simple_form_for @antenna, url: antennas_path do |f| + = render 'shared/error_messages', object: @antenna = render 'antenna_fields', f: f, lists: @lists .actions diff --git a/config/locales/en.yml b/config/locales/en.yml index 53184b39f2..e20c5c3582 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1032,6 +1032,8 @@ 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 + 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} diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 3cbd274eb3..cb2c23881e 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -999,6 +999,8 @@ ja: errors: empty_contexts: 絞り込み条件が1つも指定されていないため無効です(除外条件はカウントされません) invalid_list_owner: これはあなたのリストではありません + over_limit: 所持できるアンテナ数 %{limit}を超えています + over_stl_limit: 所持できるSTLモード付きアンテナ数 (ホーム/リストそれぞれにつき%{limit}) を超えています remove_list_with_antenna: アンテナが関連付けられているリストは削除できません edit: accounts_hint: ローカルアカウントの場合は「@info」、リモートアカウントの場合は「@info@example.com」の形式で指定します。サーバーが認識していないアカウントは保存時に自動的に削除されます。