Commit 01f0b444 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'remove-ff-environments_dashboard' into 'master'

Remove FF environments_dashboard

See merge request gitlab-org/gitlab!30598
parents 4edbaf16 2422bf10
......@@ -2,7 +2,6 @@
class OperationsController < ApplicationController
before_action :authorize_read_operations_dashboard!
before_action :environments_dashboard_feature_flag, only: %i[environments environments_list]
respond_to :json, only: [:list]
......@@ -56,10 +55,6 @@ class OperationsController < ApplicationController
render_404 unless can?(current_user, :read_operations_dashboard)
end
def environments_dashboard_feature_flag
render_404 unless Feature.enabled?(:environments_dashboard, current_user, default_enabled: true)
end
def load_projects
Dashboard::Operations::ListService.new(current_user).execute
end
......
......@@ -45,7 +45,7 @@ module EE
def get_dashboard_nav_links
super.tap do |links|
if can?(current_user, :read_operations_dashboard)
links << :environments if ::Feature.enabled?(:environments_dashboard, current_user, default_enabled: true)
links << :environments
links << :operations
end
......
......@@ -36,15 +36,6 @@ describe OperationsController do
expect(response).to render_template(:index)
end
it 'renders regardless of the environments_dashboard feature flag' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
get :index
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
context 'with an anonymous user' do
before do
sign_out(user)
......@@ -68,24 +59,6 @@ describe OperationsController do
expect(response).to render_template(:environments)
end
it 'returns a 404 when the feature is disabled' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
get :environments
expect(response).to have_gitlab_http_status(:not_found)
end
it 'renders the view when the feature is disabled for a different user' do
other_user = create(:user)
stub_feature_flags(environments_dashboard: { enabled: false, thing: other_user })
get :environments
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:environments)
end
context 'with an anonymous user' do
before do
sign_out(user)
......@@ -183,9 +156,7 @@ describe OperationsController do
expect(json_response['projects'].size).to eq(8)
end
it 'returns a list of added projects regardless of the environments_dashboard feature flag' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
it 'returns a list of added projects' do
get :list
expect(response).to have_gitlab_http_status(:ok)
......@@ -282,30 +253,6 @@ describe OperationsController do
user.update!(ops_dashboard_projects: [project])
end
it 'returns a 404 when the feature is disabled' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
environment = create(:environment, project: project)
ci_build = create(:ci_build, project: project)
create(:deployment, :success, project: project, environment: environment, deployable: ci_build)
get :environments_list
expect(response).to have_gitlab_http_status(:not_found)
end
it 'returns a project when the feature is disabled for another user' do
other_user = create(:user)
stub_feature_flags(environments_dashboard: { enabled: false, thing: other_user })
environment = create(:environment, project: project)
ci_build = create(:ci_build, project: project)
create(:deployment, :success, project: project, environment: environment, deployable: ci_build)
get :environments_list
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('dashboard/operations/environments_list', dir: 'ee')
end
it 'returns a project without an environment' do
get :environments_list
......@@ -692,16 +639,6 @@ describe OperationsController do
expect(user.ops_dashboard_projects).to contain_exactly(project_a, project_b)
end
it 'adds projects to the dashboard regardless of the environments_dashboard feature flag' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
post :create, params: { project_ids: [project_a.id, project_b.id.to_s] }
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee')
expect(json_response['added']).to contain_exactly(project_a.id, project_b.id)
end
it 'cannot add a project twice' do
post :create, params: { project_ids: [project_a.id, project_a.id] }
......@@ -782,16 +719,6 @@ describe OperationsController do
user.reload
expect(user.ops_dashboard_projects).to eq([])
end
it 'removes a project regardless of the environments_dashboard feature flag' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
delete :destroy, params: { project_id: project.id }
expect(response).to have_gitlab_http_status(:ok)
user.reload
expect(user.ops_dashboard_projects).to eq([])
end
end
context 'without projects' do
......
......@@ -11,7 +11,6 @@ describe 'Operations dropdown navbar EE' do
sign_in(user)
stub_licensed_features(operations_dashboard: true)
stub_feature_flags(environments_dashboard: true)
visit project_issues_path(project)
end
......
......@@ -67,34 +67,18 @@ describe DashboardHelper, type: :helper do
end
describe 'environments dashboard link' do
context 'when the feature is enabled' do
before do
stub_feature_flags(environments_dashboard: true)
end
context 'and the feature is available on the license' do
context 'and the user is authenticated' do
before do
stub_user_permissions_for(:operations, true)
end
it 'is included in the nav' do
expect(helper.dashboard_nav_links).to include(:environments)
end
context 'and the feature is available on the license' do
context 'and the user is authenticated' do
before do
stub_user_permissions_for(:operations, true)
end
context 'and the user is not authenticated' do
before do
stub_user_permissions_for(:operations, false)
end
it 'is not included in the nav' do
expect(helper.dashboard_nav_links).not_to include(:environments)
end
it 'is included in the nav' do
expect(helper.dashboard_nav_links).to include(:environments)
end
end
context 'and the feature is not available on the license' do
context 'and the user is not authenticated' do
before do
stub_user_permissions_for(:operations, false)
end
......@@ -105,9 +89,8 @@ describe DashboardHelper, type: :helper do
end
end
context 'when the feature is not enabled' do
context 'and the feature is not available on the license' do
before do
stub_feature_flags(environments_dashboard: false)
stub_user_permissions_for(:operations, false)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment