From de93a9309a17a8eb115499b10004ea0228813c97 Mon Sep 17 00:00:00 2001
From: rossfuhrman <rfuhrman@gitlab.com>
Date: Fri, 16 Aug 2019 17:39:37 +0000
Subject: [PATCH] Remove Security Dashboard feature flag

This removes the group_overview_security_dashboard feature flag
---
 ...erview-security-dashboard-feature-flag.yml |  5 ++
 ee/app/controllers/ee/groups_controller.rb    |  2 +-
 ee/app/helpers/ee/preferences_helper.rb       |  2 +-
 ee/lib/ee/gitlab/usage_data.rb                | 10 ++--
 .../groups/groups_controller_spec.rb          | 46 -------------------
 ee/spec/helpers/preferences_helper_spec.rb    | 16 -------
 ee/spec/lib/gitlab/usage_data_spec.rb         |  5 --
 lib/gitlab/usage_data.rb                      |  4 +-
 spec/lib/gitlab/usage_data_spec.rb            |  5 --
 9 files changed, 12 insertions(+), 83 deletions(-)
 create mode 100644 changelogs/unreleased/rf-remove-group-overview-security-dashboard-feature-flag.yml

diff --git a/changelogs/unreleased/rf-remove-group-overview-security-dashboard-feature-flag.yml b/changelogs/unreleased/rf-remove-group-overview-security-dashboard-feature-flag.yml
new file mode 100644
index 0000000000000..f412ba11b91de
--- /dev/null
+++ b/changelogs/unreleased/rf-remove-group-overview-security-dashboard-feature-flag.yml
@@ -0,0 +1,5 @@
+---
+title: Remove Security Dashboard feature flag
+merge_request: 31820
+author:
+type: other
diff --git a/ee/app/controllers/ee/groups_controller.rb b/ee/app/controllers/ee/groups_controller.rb
index 5f741f4509733..46b52346fed6f 100644
--- a/ee/app/controllers/ee/groups_controller.rb
+++ b/ee/app/controllers/ee/groups_controller.rb
@@ -44,7 +44,7 @@ def redirect_show_path
       strong_memoize(:redirect_show_path) do
         case group_view
         when 'security_dashboard'
-          helpers.group_security_dashboard_path(group) if ::Feature.enabled?(:group_overview_security_dashboard)
+          helpers.group_security_dashboard_path(group)
         else
           nil
         end
diff --git a/ee/app/helpers/ee/preferences_helper.rb b/ee/app/helpers/ee/preferences_helper.rb
index 75c2ad1d9580b..97e86e21efb65 100644
--- a/ee/app/helpers/ee/preferences_helper.rb
+++ b/ee/app/helpers/ee/preferences_helper.rb
@@ -27,7 +27,7 @@ def group_overview_content_preference?
     private
 
     def group_view_security_dashboard_enabled?
-      License.feature_available?(:security_dashboard) && ::Feature.enabled?(:group_overview_security_dashboard)
+      License.feature_available?(:security_dashboard)
     end
   end
 end
diff --git a/ee/lib/ee/gitlab/usage_data.rb b/ee/lib/ee/gitlab/usage_data.rb
index 0cb1e6b4ff860..e6ad74d3c0390 100644
--- a/ee/lib/ee/gitlab/usage_data.rb
+++ b/ee/lib/ee/gitlab/usage_data.rb
@@ -101,12 +101,10 @@ def security_products_usage
         override :user_preferences_usage
         def user_preferences_usage
           super.tap do |user_prefs_usage|
-            if ::Feature.enabled?(:group_overview_security_dashboard)
-              user_prefs_usage.merge!(
-                group_overview_details: count(::User.active.group_view_details),
-                group_overview_security_dashboard: count(::User.active.group_view_security_dashboard)
-              )
-            end
+            user_prefs_usage.merge!(
+              group_overview_details: count(::User.active.group_view_details),
+              group_overview_security_dashboard: count(::User.active.group_view_security_dashboard)
+            )
           end
         end
 
diff --git a/ee/spec/controllers/groups/groups_controller_spec.rb b/ee/spec/controllers/groups/groups_controller_spec.rb
index cea66a766e6e7..62ecba4932c28 100644
--- a/ee/spec/controllers/groups/groups_controller_spec.rb
+++ b/ee/spec/controllers/groups/groups_controller_spec.rb
@@ -140,42 +140,6 @@
               expect(subject).to render_template('groups/show')
             end
           end
-
-          context 'and the feature flag is disabled' do
-            before do
-              stub_feature_flags(group_overview_security_dashboard: false)
-            end
-
-            it 'renders the expected template' do
-              expect(subject).to render_template('groups/show')
-            end
-          end
-        end
-      end
-
-      context 'when feature flag is disabled' do
-        before do
-          stub_feature_flags(group_overview_security_dashboard: false)
-        end
-
-        let(:user) { create(:user, group_view: :security_dashboard) } # not a member of a group
-
-        context 'when security dashboard feature is enabled' do
-          before do
-            stub_licensed_features(security_dashboard: true)
-          end
-
-          context 'when user is not allowed to access group security dashboard' do
-            it 'works because security dashboard is not rendered' do
-              expect(subject).to have_gitlab_http_status(200)
-            end
-          end
-        end
-
-        context 'when security dashboard feature is disabled' do
-          it 'works because security dashboard is not rendered' do
-            expect(subject).to have_gitlab_http_status(200)
-          end
         end
       end
     end
@@ -194,16 +158,6 @@
           it 'does not redirect to the security dashboard' do
             expect(subject).not_to redirect_to(group_security_dashboard_url(group))
           end
-
-          context 'and the feature flag is disabled' do
-            before do
-              stub_feature_flags(group_overview_security_dashboard: false)
-            end
-
-            it 'renders the expected template' do
-              expect(subject).to render_template('groups/show')
-            end
-          end
         end
       end
     end
diff --git a/ee/spec/helpers/preferences_helper_spec.rb b/ee/spec/helpers/preferences_helper_spec.rb
index e04276b4c0e88..864d6f2804eae 100644
--- a/ee/spec/helpers/preferences_helper_spec.rb
+++ b/ee/spec/helpers/preferences_helper_spec.rb
@@ -40,14 +40,6 @@
       end
 
       it { is_expected.to include(['Security dashboard', :security_dashboard]) }
-
-      context 'but feature flag is disabled' do
-        before do
-          stub_feature_flags(group_overview_security_dashboard: false)
-        end
-
-        it { is_expected.not_to include(['Security dashboard', :security_dashboard]) }
-      end
     end
 
     context 'when security dashboard feature is disabled' do
@@ -64,14 +56,6 @@
       end
 
       it { is_expected.to eq(true) }
-
-      context 'but feature flag is disabled' do
-        before do
-          stub_feature_flags(group_overview_security_dashboard: false)
-        end
-
-        it { is_expected.to eq(false) }
-      end
     end
 
     context 'when security dashboard feature is disabled' do
diff --git a/ee/spec/lib/gitlab/usage_data_spec.rb b/ee/spec/lib/gitlab/usage_data_spec.rb
index 203cb6db34584..dff61f4d7d263 100644
--- a/ee/spec/lib/gitlab/usage_data_spec.rb
+++ b/ee/spec/lib/gitlab/usage_data_spec.rb
@@ -112,11 +112,6 @@
         group_overview_security_dashboard: 2
       )
     end
-
-    it 'does not gather group overview preferences usage data when the feature is disabled' do
-      stub_feature_flags(group_overview_security_dashboard: false)
-      expect(subject[:counts].keys).not_to include(:user_preferences)
-    end
   end
 
   describe '#features_usage_data_ee' do
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index b905b31370608..983eebdeacd8f 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -100,9 +100,7 @@ def system_usage_data
           .merge(services_usage)
           .merge(approximate_counts)
         }.tap do |data|
-          if Feature.enabled?(:group_overview_security_dashboard)
-            data[:counts][:user_preferences] = user_preferences_usage
-          end
+          data[:counts][:user_preferences] = user_preferences_usage
         end
       end
       # rubocop: enable CodeReuse/ActiveRecord
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index 588c68d1fb0fa..9bbd9394d572e 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -154,11 +154,6 @@
       expect(expected_keys - count_data.keys).to be_empty
     end
 
-    it 'does not gather user preferences usage data when the feature is disabled' do
-      stub_feature_flags(group_overview_security_dashboard: false)
-      expect(subject[:counts].keys).not_to include(:user_preferences)
-    end
-
     it 'gathers projects data correctly' do
       count_data = subject[:counts]
 
-- 
GitLab