Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario de la Ossa <mariodelaossa@gmail.com>2019-05-22 07:04:19 +0300
committerMario de la Ossa <mariodelaossa@gmail.com>2019-06-05 23:42:00 +0300
commitf2698e05ebaefc8eb14ce9326c97a6367ee5e33c (patch)
treeb93b4e62e31ce3434aa4afce218bc94dafdf508b /app/models
parentbb4919103116aa6aa7cf851fc29a8841ffd78026 (diff)
Backport of 10854-elasticsearch_avoid_db
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project_feature.rb2
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)