mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
FIX: site_contact_user should default to system user, not first admin user
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user