Commit f81ca9d0 authored by Ash McKenzie's avatar Ash McKenzie

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

Remove show_inherited_labels FF

See merge request gitlab-org/gitlab!50378
parents 1e60ea99 9545cbed
# frozen_string_literal: true
module ShowInheritedLabelsChecker
extend ActiveSupport::Concern
private
def show_inherited_labels?(include_ancestor_groups)
Feature.enabled?(:show_inherited_labels, @project || @group, default_enabled: true) || include_ancestor_groups # rubocop:disable Gitlab/ModuleWithInstanceVariables
end
end
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
class Groups::LabelsController < Groups::ApplicationController class Groups::LabelsController < Groups::ApplicationController
include ToggleSubscriptionAction include ToggleSubscriptionAction
include ShowInheritedLabelsChecker
before_action :label, only: [:edit, :update, :destroy] before_action :label, only: [:edit, :update, :destroy]
before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy] before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy]
...@@ -112,7 +111,7 @@ class Groups::LabelsController < Groups::ApplicationController ...@@ -112,7 +111,7 @@ class Groups::LabelsController < Groups::ApplicationController
current_user, current_user,
group_id: @group.id, group_id: @group.id,
only_group_labels: options[:only_group_labels], only_group_labels: options[:only_group_labels],
include_ancestor_groups: show_inherited_labels?(params[:include_ancestor_groups]), include_ancestor_groups: true,
sort: sort, sort: sort,
subscribed: options[:subscribed], subscribed: options[:subscribed],
include_descendant_groups: options[:include_descendant_groups], include_descendant_groups: options[:include_descendant_groups],
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
class Projects::LabelsController < Projects::ApplicationController class Projects::LabelsController < Projects::ApplicationController
include ToggleSubscriptionAction include ToggleSubscriptionAction
include ShowInheritedLabelsChecker
before_action :check_issuables_available! before_action :check_issuables_available!
before_action :label, only: [:edit, :update, :destroy, :promote] before_action :label, only: [:edit, :update, :destroy, :promote]
...@@ -164,7 +163,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -164,7 +163,7 @@ class Projects::LabelsController < Projects::ApplicationController
@available_labels ||= @available_labels ||=
LabelsFinder.new(current_user, LabelsFinder.new(current_user,
project_id: @project.id, project_id: @project.id,
include_ancestor_groups: show_inherited_labels?(params[:include_ancestor_groups]), include_ancestor_groups: true,
search: params[:search], search: params[:search],
subscribed: params[:subscribed], subscribed: params[:subscribed],
sort: sort).execute sort: sort).execute
......
---
name: show_inherited_labels
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42960
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/267547
milestone: '13.5'
type: development
group: group::project management
default_enabled: true
...@@ -9,8 +9,6 @@ RSpec.describe Groups::LabelsController do ...@@ -9,8 +9,6 @@ RSpec.describe Groups::LabelsController do
before do before do
group.add_owner(user) group.add_owner(user)
# by default FFs are enabled in specs so we turn it off
stub_feature_flags(show_inherited_labels: false)
sign_in(user) sign_in(user)
end end
...@@ -34,8 +32,8 @@ RSpec.describe Groups::LabelsController do ...@@ -34,8 +32,8 @@ RSpec.describe Groups::LabelsController do
subgroup.add_owner(user) subgroup.add_owner(user)
end end
RSpec.shared_examples 'returns ancestor group labels' do
it 'returns ancestor group labels' do it 'returns ancestor group labels' do
params = { group_id: subgroup, only_group_labels: true }
get :index, params: params, format: :json get :index, params: params, format: :json
label_ids = json_response.map {|label| label['title']} label_ids = json_response.map {|label| label['title']}
...@@ -43,35 +41,6 @@ RSpec.describe Groups::LabelsController do ...@@ -43,35 +41,6 @@ RSpec.describe Groups::LabelsController do
end end
end end
context 'when include_ancestor_groups true' do
let(:params) { { group_id: subgroup, include_ancestor_groups: true, only_group_labels: true } }
it_behaves_like 'returns ancestor group labels'
end
context 'when include_ancestor_groups false' do
let(:params) { { group_id: subgroup, only_group_labels: true } }
it 'does not return ancestor group labels', :aggregate_failures do
get :index, params: params, format: :json
label_ids = json_response.map {|label| label['title']}
expect(label_ids).to match_array([subgroup_label_1.title])
expect(label_ids).not_to include([group_label_1.title])
end
end
context 'when show_inherited_labels enabled' do
let(:params) { { group_id: subgroup } }
before do
stub_feature_flags(show_inherited_labels: true)
end
it_behaves_like 'returns ancestor group labels'
end
end
context 'external authorization' do context 'external authorization' do
subject { get :index, params: { group_id: group.to_param } } subject { get :index, params: { group_id: group.to_param } }
......
...@@ -84,8 +84,8 @@ RSpec.describe Projects::LabelsController do ...@@ -84,8 +84,8 @@ RSpec.describe Projects::LabelsController do
create(:label_priority, project: project, label: subgroup_label_2, priority: 1) create(:label_priority, project: project, label: subgroup_label_2, priority: 1)
end end
RSpec.shared_examples 'returns ancestor group labels' do
it 'returns ancestor group labels', :aggregate_failures do it 'returns ancestor group labels', :aggregate_failures do
params = { namespace_id: project.namespace.to_param, project_id: project }
get :index, params: params get :index, params: params
expect(assigns(:labels)).to match_array([subgroup_label_1] + group_labels + project_labels) expect(assigns(:labels)).to match_array([subgroup_label_1] + group_labels + project_labels)
...@@ -93,40 +93,6 @@ RSpec.describe Projects::LabelsController do ...@@ -93,40 +93,6 @@ RSpec.describe Projects::LabelsController do
end end
end end
context 'when show_inherited_labels disabled' do
before do
stub_feature_flags(show_inherited_labels: false)
end
context 'when include_ancestor_groups false' do
let(:params) { { namespace_id: project.namespace.to_param, project_id: project } }
it 'does not return ancestor group labels', :aggregate_failures do
get :index, params: params
expect(assigns(:labels)).to match_array([subgroup_label_1] + project_labels)
expect(assigns(:prioritized_labels)).to match_array([subgroup_label_2] + project_priority_labels)
end
end
context 'when include_ancestor_groups true' do
let(:params) { { namespace_id: project.namespace.to_param, project_id: project, include_ancestor_groups: true } }
it_behaves_like 'returns ancestor group labels'
end
end
context 'when show_inherited_labels enabled' do
let(:params) { { namespace_id: project.namespace.to_param, project_id: project } }
before do
stub_feature_flags(show_inherited_labels: true)
end
it_behaves_like 'returns ancestor group labels'
end
end
def list_labels def list_labels
get :index, params: { namespace_id: project.namespace.to_param, project_id: project } get :index, params: { namespace_id: project.namespace.to_param, project_id: project }
end 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