Make account domains case-insensitive, downcase before checking against local

lolsob-rspec
Eugen Rochko 2016-10-10 03:34:15 +02:00
parent 7cb55af441
commit 12a6eb95be
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ class TagManager
end end
def local_domain?(domain) def local_domain?(domain)
domain.nil? || domain.gsub(/[\/]/, '') == Rails.configuration.x.local_domain domain.nil? || domain.gsub(/[\/]/, '').downcase == Rails.configuration.x.local_domain.downcase
end end
def uri_for(target) def uri_for(target)

View File

@ -125,7 +125,7 @@ class Account < ApplicationRecord
end end
def self.find_remote!(username, domain) def self.find_remote!(username, domain)
where(arel_table[:username].matches(username)).where(domain: domain).take! where(arel_table[:username].matches(username)).where(domain.nil? ? { domain: nil } : arel_table[:domain].matches(domain)).take!
end end
def self.find_local(username) def self.find_local(username)