diff options
author | Mario de la Ossa <mariodelaossa@gmail.com> | 2019-05-22 07:04:19 +0300 |
---|---|---|
committer | Mario de la Ossa <mariodelaossa@gmail.com> | 2019-06-05 23:42:00 +0300 |
commit | f2698e05ebaefc8eb14ce9326c97a6367ee5e33c (patch) | |
tree | b93b4e62e31ce3434aa4afce218bc94dafdf508b /app/models/project_feature.rb | |
parent | bb4919103116aa6aa7cf851fc29a8841ffd78026 (diff) |
Backport of 10854-elasticsearch_avoid_db
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 0542581c6e0..6bcb051bff6 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -72,6 +72,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 + scope :for_project_id, -> (project) { where(project: project) } + 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) |