Fix Performance/MapCompact cop (#24797)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
		@@ -4,14 +4,14 @@ class ExistingUsernameValidator < ActiveModel::EachValidator
 | 
			
		||||
  def validate_each(record, attribute, value)
 | 
			
		||||
    return if value.blank?
 | 
			
		||||
 | 
			
		||||
    usernames_and_domains = value.split(',').map do |str|
 | 
			
		||||
    usernames_and_domains = value.split(',').filter_map do |str|
 | 
			
		||||
      username, domain = str.strip.gsub(/\A@/, '').split('@', 2)
 | 
			
		||||
      domain = nil if TagManager.instance.local_domain?(domain)
 | 
			
		||||
 | 
			
		||||
      next if username.blank?
 | 
			
		||||
 | 
			
		||||
      [str, username, domain]
 | 
			
		||||
    end.compact
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    usernames_with_no_accounts = usernames_and_domains.filter_map do |(str, username, domain)|
 | 
			
		||||
      str unless Account.find_remote(username, domain)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user