FIX: site_contact_user should default to system user, not first admin user

This commit is contained in:
Neil Lalonde
2015-11-24 14:37:41 -05:00
parent d65ec1af2e
commit f4d44187c8
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -272,7 +272,7 @@ module Discourse
# Either returns the site_contact_username user or the first admin.
def self.site_contact_user
user = User.find_by(username_lower: SiteSetting.site_contact_username.downcase) if SiteSetting.site_contact_username.present?
user ||= User.admins.real.order(:id).first
user ||= (system_user || User.admins.real.order(:id).first)
end
SYSTEM_USER_ID ||= -1
+2 -2
View File
@@ -62,9 +62,9 @@ describe Discourse do
expect(Discourse.site_contact_user).to eq(another_admin)
end
it 'returns the first admin user otherwise' do
it 'returns the system user otherwise' do
SiteSetting.stubs(:site_contact_username).returns(nil)
expect(Discourse.site_contact_user).to eq(admin)
expect(Discourse.site_contact_user.username).to eq("system")
end
end