Add antenna list account validation
This commit is contained in:
parent
2fef21664b
commit
9d4b306f08
3 changed files with 8 additions and 0 deletions
|
@ -34,6 +34,12 @@ class Antenna < ApplicationRecord
|
||||||
scope :all_tags, -> { where(any_tags: true) }
|
scope :all_tags, -> { where(any_tags: true) }
|
||||||
scope :availables, -> { where(available: true).where(Arel.sql('any_keywords = FALSE OR any_domains = FALSE OR any_accounts = FALSE OR any_tags = FALSE')) }
|
scope :availables, -> { where(available: true).where(Arel.sql('any_keywords = FALSE OR any_domains = FALSE OR any_accounts = FALSE OR any_tags = FALSE')) }
|
||||||
|
|
||||||
|
validate :list_owner
|
||||||
|
|
||||||
|
def list_owner
|
||||||
|
raise Mastodon::ValidationError, I18n.t('antennas.errors.invalid_list_owner') if list.account != account
|
||||||
|
end
|
||||||
|
|
||||||
def enabled?
|
def enabled?
|
||||||
enabled_config? && !expired?
|
enabled_config? && !expired?
|
||||||
end
|
end
|
||||||
|
|
|
@ -990,6 +990,7 @@ en:
|
||||||
deprecated_api_multiple_keywords: These parameters cannot be changed from this application because they apply to more than one filter keyword. Use a more recent application or the web interface.
|
deprecated_api_multiple_keywords: These parameters cannot be changed from this application because they apply to more than one filter keyword. Use a more recent application or the web interface.
|
||||||
empty_contexts: No contexts! You must set any context filters
|
empty_contexts: No contexts! You must set any context filters
|
||||||
invalid_context: None or invalid context supplied
|
invalid_context: None or invalid context supplied
|
||||||
|
invalid_list_owner: This list is not yours
|
||||||
index:
|
index:
|
||||||
contexts: Antennas in %{contexts}
|
contexts: Antennas in %{contexts}
|
||||||
delete: Delete
|
delete: Delete
|
||||||
|
|
|
@ -949,6 +949,7 @@ ja:
|
||||||
tag: ハッシュタグ
|
tag: ハッシュタグ
|
||||||
errors:
|
errors:
|
||||||
empty_contexts: 絞り込み条件が1つも指定されていないため無効です(除外条件はカウントされません)
|
empty_contexts: 絞り込み条件が1つも指定されていないため無効です(除外条件はカウントされません)
|
||||||
|
invalid_list_owner: これはあなたのリストではありません
|
||||||
edit:
|
edit:
|
||||||
accounts_hint: ローカルアカウントの場合は「@info」、リモートアカウントの場合は「@info@example.com」の形式で指定します。サーバーが認識していないアカウントは保存時に自動的に削除されます。
|
accounts_hint: ローカルアカウントの場合は「@info」、リモートアカウントの場合は「@info@example.com」の形式で指定します。サーバーが認識していないアカウントは保存時に自動的に削除されます。
|
||||||
accounts_raw: 絞り込むアカウント
|
accounts_raw: 絞り込むアカウント
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue