mirror of
https://github.com/discourse/discourse.git
synced 2025-04-14 08:21:40 +08:00
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.
|
# Either returns the site_contact_username user or the first admin.
|
||||||
def self.site_contact_user
|
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
|
user ||= User.admins.real.order(:id).first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -57,6 +57,11 @@ describe Discourse do
|
|||||||
Discourse.site_contact_user.should == another_admin
|
Discourse.site_contact_user.should == another_admin
|
||||||
end
|
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
|
it 'returns the first admin user otherwise' do
|
||||||
SiteSetting.stubs(:site_contact_username).returns(nil)
|
SiteSetting.stubs(:site_contact_username).returns(nil)
|
||||||
Discourse.site_contact_user.should == admin
|
Discourse.site_contact_user.should == admin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user