mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:12:45 +08:00
FIX: site_contact_user should default to system user, not first admin user
This commit is contained in:
parent
d65ec1af2e
commit
f4d44187c8
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user