BUGFIX: site_contact_username was case-sensitive
This commit is contained in:
parent
202d1064ea
commit
bfc9664231
|
@ -168,7 +168,7 @@ module Discourse
|
|||
|
||||
# Either returns the site_contact_username user or the first admin.
|
||||
def self.site_contact_user
|
||||
user = User.where(username_lower: SiteSetting.site_contact_username).first if SiteSetting.site_contact_username.present?
|
||||
user = User.where(username_lower: SiteSetting.site_contact_username.downcase).first if SiteSetting.site_contact_username.present?
|
||||
user ||= User.admins.real.order(:id).first
|
||||
end
|
||||
|
||||
|
|
|
@ -57,6 +57,11 @@ describe Discourse do
|
|||
Discourse.site_contact_user.should == another_admin
|
||||
end
|
||||
|
||||
it 'returns the user specified by the site setting site_contact_username regardless of its case' do
|
||||
SiteSetting.stubs(:site_contact_username).returns(another_admin.username.upcase)
|
||||
Discourse.site_contact_user.should == another_admin
|
||||
end
|
||||
|
||||
it 'returns the first admin user otherwise' do
|
||||
SiteSetting.stubs(:site_contact_username).returns(nil)
|
||||
Discourse.site_contact_user.should == admin
|
||||
|
|
Loading…
Reference in New Issue