Skip to content

Commit

Permalink
FIX: site_contact_user should default to system user, not first admin…
Browse files Browse the repository at this point in the history
… user
  • Loading branch information
nlalonde committed Nov 24, 2015
1 parent d65ec1a commit f4d4418
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/discourse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def self.git_branch
# 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
Expand Down
4 changes: 2 additions & 2 deletions spec/components/discourse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
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
Expand Down

0 comments on commit f4d4418

Please sign in to comment.