Skip to content

Commit 59e525f

Browse files
Gargronchrisguida
authored andcommitted
Fix existing username validator not allowing multiple accounts (mastodon#16153)
Fix mastodon#16107
1 parent e5d75ab commit 59e525f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

app/validators/existing_username_validator.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ def validate_each(record, attribute, value)
1919
str unless Account.find_remote(username, domain)
2020
end
2121

22-
if usernames_with_no_accounts.any? && options[:multiple]
23-
record.errors.add(attribute, I18n.t('existing_username_validator.not_found_multiple', usernames: usernames_with_no_accounts.join(', ')))
24-
elsif usernames_with_no_accounts.any? || usernames_and_domains.size > 1
25-
record.errors.add(attribute, I18n.t('existing_username_validator.not_found'))
22+
if options[:multiple]
23+
record.errors.add(attribute, I18n.t('existing_username_validator.not_found_multiple', usernames: usernames_with_no_accounts.join(', '))) if usernames_with_no_accounts.any?
24+
else
25+
record.errors.add(attribute, I18n.t('existing_username_validator.not_found')) if usernames_with_no_accounts.any? || usernames_and_domains.size > 1
2626
end
2727
end
2828
end

0 commit comments

Comments
 (0)