commit: aec51e40ee98b1a73d59b1456e61709d49c61552
parent: 5f737c72282b981e3e637e5b4836ce45a161947c
Author: Eugen Rochko <eugen@zeonfederated.com>
Date: Mon, 10 Oct 2016 03:34:15 +0200
Make account domains case-insensitive, downcase before checking against local
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/lib/tag_manager.rb b/app/lib/tag_manager.rb
@@ -18,7 +18,7 @@ class TagManager
end
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
def uri_for(target)
diff --git a/app/models/account.rb b/app/models/account.rb
@@ -125,7 +125,7 @@ class Account < ApplicationRecord
end
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
def self.find_local(username)