diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2019-07-17 15:56:58 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-17 15:56:58 +0300 |
commit | 6796dcf27715f9a149387bb80e7a359208602f1f (patch) | |
tree | 33528ecb1d26a828835ad22d5151f189d1c668a2 /app/models/project_feature.rb | |
parent | 9c3dfd2085369005305260bdaec872cb078a758e (diff) |
Fix wrong pages access level default
- Set access level in before_validation hook
- Add post migration for updating existing project_features
Diffstat (limited to 'app/models/project_feature.rb')
-rw-r--r-- | app/models/project_feature.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb index 7ff06655de0..78e82955342 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -86,6 +86,8 @@ class ProjectFeature < ApplicationRecord default_value_for :wiki_access_level, value: ENABLED, allows_nil: false default_value_for :repository_access_level, value: ENABLED, allows_nil: false + default_value_for(:pages_access_level, allows_nil: false) { |feature| feature.project&.public? ? ENABLED : PRIVATE } + def feature_available?(feature, user) # This feature might not be behind a feature flag at all, so default to true return false unless ::Feature.enabled?(feature, user, default_enabled: true) |