From 44f6e171e8fa4785bf1790e09871809480da22fb Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 21 Sep 2018 15:43:24 -0500 Subject: Add ProjectFeature check for feature flag This will allow an explicitly-disabled feature flag to override a feature being available for a project. As an extreme example, we could quickly disable issues across all projects at runtime by running `Feature.disable(:issues)`. --- app/models/project_feature.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/models/project_feature.rb') diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb index d74cb2506ba..346db2847d8 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -59,6 +59,9 @@ class ProjectFeature < ActiveRecord::Base after_update :update_site_statistics 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) + get_permission(user, access_level(feature)) end -- cgit v1.2.1