]> cat aescling's git repositories - mastodon.git/commitdiff
Make account domains case-insensitive, downcase before checking against local
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 10 Oct 2016 01:34:15 +0000 (03:34 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 10 Oct 2016 01:34:15 +0000 (03:34 +0200)
app/lib/tag_manager.rb
app/models/account.rb

index ad76d10c47c5a2d55d12356709f8f2611c48307c..d2cf35b49ff02caf3878dd7f5259c9dbc581cc3b 100644 (file)
@@ -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)
index e43d51b1c46d590c83292fd994116ab7eb54c267..c1b52ea1ba91abf6ce23f8aa4c7d6a18e12b3ac9 100644 (file)
@@ -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)