about summary refs log tree commit diff
path: root/app/validators
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2021-01-11 13:44:57 +0100
committerGitHub <noreply@github.com>2021-01-11 13:44:57 +0100
commita7a47834e50645746355e2b9a88244c1804c73cd (patch)
tree3b81b1d2a4b2c2d2e4b29948c72a7995a21fa449 /app/validators
parentd42e7e01dcd464f80637682d4eee6e5a7f36f26e (diff)
parent31e68bf3d35b80e794c1a44b3d60dabcf10f2a3d (diff)
Merge pull request #1483 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/validators')
-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@/, ''))