mirror of https://github.com/tootsuite/mastodon
Fix confusing error when failing to add an alias to an unknown account (#13480)
Follow-up to #13452, fixing broken `uri.nil?` test. Also remove the separate check for `uri` presence, as that would result in a “Please review 2 errors below” while only one would be listed.pull/13481/head
parent
5edff32733
commit
3825e1943f
|
@ -16,7 +16,6 @@ class AccountAlias < ApplicationRecord
|
||||||
belongs_to :account
|
belongs_to :account
|
||||||
|
|
||||||
validates :acct, presence: true, domain: { acct: true }
|
validates :acct, presence: true, domain: { acct: true }
|
||||||
validates :uri, presence: true
|
|
||||||
validates :uri, uniqueness: { scope: :account_id }
|
validates :uri, uniqueness: { scope: :account_id }
|
||||||
validate :validate_target_account
|
validate :validate_target_account
|
||||||
|
|
||||||
|
@ -47,7 +46,7 @@ class AccountAlias < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_target_account
|
def validate_target_account
|
||||||
if uri.nil?
|
if uri.blank?
|
||||||
errors.add(:acct, I18n.t('migrations.errors.not_found'))
|
errors.add(:acct, I18n.t('migrations.errors.not_found'))
|
||||||
elsif ActivityPub::TagManager.instance.uri_for(account) == uri
|
elsif ActivityPub::TagManager.instance.uri_for(account) == uri
|
||||||
errors.add(:acct, I18n.t('migrations.errors.move_to_self'))
|
errors.add(:acct, I18n.t('migrations.errors.move_to_self'))
|
||||||
|
|
Loading…
Reference in New Issue