From 12a6eb95beed6f41384b7f67df8022eecaeccc46 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 10 Oct 2016 03:34:15 +0200 Subject: [PATCH] Make account domains case-insensitive, downcase before checking against local --- app/lib/tag_manager.rb | 2 +- app/models/account.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/tag_manager.rb b/app/lib/tag_manager.rb index ad76d10c47..d2cf35b49f 100644 --- 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 index e43d51b1c4..c1b52ea1ba 100644 --- 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)