diff options
author | Rémy Coutable <remy@rymai.me> | 2018-12-12 14:59:06 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-12-19 13:24:53 +0300 |
commit | 71672dfa6afbb374b24ae5457a58204708d948ed (patch) | |
tree | b052e1b02af0d0d6b70b704960a9fb357c3fb42d /app | |
parent | ffef28ccd6d37ade2c3ee3ca46679749f9cf09aa (diff) |
Return an ApplicationSetting in CurrentSettings
This replaces the use of fake_application_settings with
`::ApplicationSetting.build`_from_defaults. The reason is that
`fake_application_settings` doesn't have the custom accessors that
`ApplicationSetting` has, e.g. `#commit_email_hostname`, thus this
can lead to unexpected `nil` values which comes from the database
column instead of `.default_commit_email_hostname` returned by
`ApplicationSetting#commit_email_hostname`.
Using `::ApplicationSetting.build_from_defaults` should be safe as it
doesn't try to `INSERT` a DB record, in contrary to
`::ApplicationSetting.create_from_defaults` which we used to use, and
which created issues that the introduction of
`fake_application_settings` tried to resolve (575dced5).
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app')
-rw-r--r-- | app/models/application_setting.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 4319db42019..54139f61a16 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -382,7 +382,7 @@ class ApplicationSetting < ActiveRecord::Base end def restricted_visibility_levels=(levels) - super(levels.map { |level| Gitlab::VisibilityLevel.level_value(level) }) + super(levels&.map { |level| Gitlab::VisibilityLevel.level_value(level) }) end def strip_sentry_values |