about summary refs log tree commit diff
path: root/app/validators/existing_username_validator.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-01-11 11:55:42 +0100
committerClaire <claire.github-309c@sitedethib.com>2021-01-11 11:55:42 +0100
commit33d30632fb627ba1742eff3e0c5fc84ccd156cdb (patch)
treeb7c15bb354c9d2f0ef25c50ab387007703f599d6 /app/validators/existing_username_validator.rb
parentd42e7e01dcd464f80637682d4eee6e5a7f36f26e (diff)
parent11d603101a7b3389c679b8c155a3cb06203ca31a (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- `app/models/public_feed.rb`:
  Upstream refactored a bit, glitch-soc had specific code for local-only
  statuses.
  Updated glitch-soc's specific code accordingly.
Diffstat (limited to 'app/validators/existing_username_validator.rb')
-rw-r--r--app/validators/existing_username_validator.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/validators/existing_username_validator.rb b/app/validators/existing_username_validator.rb
index b31d09827..723302ec9 100644
--- a/app/validators/existing_username_validator.rb
+++ b/app/validators/existing_username_validator.rb
@@ -5,7 +5,7 @@ class ExistingUsernameValidator < ActiveModel::EachValidator
     return if value.blank?
 
     if options[:multiple]
-      missing_usernames = value.split(',').map { |username| username.strip.gsub(/\A@/, '') }.map { |username| username unless Account.find_local(username) }.compact
+      missing_usernames = value.split(',').map { |username| username.strip.gsub(/\A@/, '') }.filter_map { |username| username unless Account.find_local(username) }
       record.errors.add(attribute, I18n.t('existing_username_validator.not_found_multiple', usernames: missing_usernames.join(', '))) if missing_usernames.any?
     else
       record.errors.add(attribute, I18n.t('existing_username_validator.not_found')) unless Account.find_local(value.strip.gsub(/\A@/, ''))