summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-09-21 13:10:27 +0300
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-09-21 15:52:25 +0300
commit9747f3ef7b34be5c104ad1a1ff541288274abc8e (patch)
tree892c5af2ea1fdb41d9467523852ce0bae889067b
parentc2a7e7b8ac283f19ef324e93380ea1c802c6e7d0 (diff)
downloadgitlab-ce-9747f3ef7b34be5c104ad1a1ff541288274abc8e.tar.gz
Add default values for ProjectFeature
Closes gitlab-org/gitlab-ce#22330
-rw-r--r--app/models/project_feature.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb
index 9c602c582bd..6f5eb43be0f 100644
--- a/app/models/project_feature.rb
+++ b/app/models/project_feature.rb
@@ -22,6 +22,13 @@ class ProjectFeature < ActiveRecord::Base
belongs_to :project
+ default_value_for :builds_access_level, value: ENABLED, allows_nil: false
+ default_value_for :merge_requests_access_level, value: ENABLED, allows_nil: false
+ default_value_for :issues_access_level, value: ENABLED, allows_nil: false
+ default_value_for :merge_requests_access_level, value: ENABLED, allows_nil: false
+ default_value_for :snippets_access_level, value: ENABLED, allows_nil: false
+ default_value_for :wiki_access_level, value: ENABLED, allows_nil: false
+
def feature_available?(feature, user)
raise ArgumentError, 'invalid project feature' unless FEATURES.include?(feature)