Commit 0f89e4e0 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'requriements_flg_remove' into 'master'

Remove requirements_management flag

See merge request gitlab-org/gitlab!43390
parents fbfed480 f9069504
......@@ -13714,7 +13714,7 @@ type Project {
requestAccessEnabled: Boolean
"""
Find a single requirement. Available only when feature flag `requirements_management` is enabled.
Find a single requirement
"""
requirement(
"""
......@@ -13754,7 +13754,7 @@ type Project {
requirementStatesCount: RequirementStatesCount
"""
Find requirements. Available only when feature flag `requirements_management` is enabled.
Find requirements
"""
requirements(
"""
......
......@@ -39901,7 +39901,7 @@
},
{
"name": "requirement",
"description": "Find a single requirement. Available only when feature flag `requirements_management` is enabled.",
"description": "Find a single requirement",
"args": [
{
"name": "iid",
......@@ -40004,7 +40004,7 @@
},
{
"name": "requirements",
"description": "Find requirements. Available only when feature flag `requirements_management` is enabled.",
"description": "Find requirements",
"args": [
{
"name": "iid",
......@@ -1899,7 +1899,7 @@ Autogenerated return type of PipelineRetry.
| `removeSourceBranchAfterMerge` | Boolean | Indicates if `Delete source branch` option should be enabled by default for all new merge requests of the project |
| `repository` | Repository | Git repository of the project |
| `requestAccessEnabled` | Boolean | Indicates if users can request member access to the project |
| `requirement` | Requirement | Find a single requirement. Available only when feature flag `requirements_management` is enabled. |
| `requirement` | Requirement | Find a single requirement |
| `requirementStatesCount` | RequirementStatesCount | Number of requirements for the project by their state |
| `sastCiConfiguration` | SastCiConfiguration | SAST CI configuration for the project |
| `securityDashboardPath` | String | Path to project's security dashboard |
......
......@@ -2,20 +2,10 @@
class Projects::RequirementsManagement::RequirementsController < Projects::ApplicationController
before_action :authorize_read_requirement!
before_action :verify_requirements_management_flag!
before_action do
push_frontend_feature_flag(:requirements_management, project, default_enabled: true)
end
def index
respond_to do |format|
format.html
end
end
private
def verify_requirements_management_flag!
render_404 unless Feature.enabled?(:requirements_management, project, default_enabled: true)
end
end
......@@ -52,17 +52,17 @@ module EE
resolver: ::Resolvers::VulnerabilitySeveritiesCountResolver
field :requirement, ::Types::RequirementsManagement::RequirementType, null: true,
description: 'Find a single requirement. Available only when feature flag `requirements_management` is enabled.',
description: 'Find a single requirement',
resolver: ::Resolvers::RequirementsManagement::RequirementsResolver.single
field :requirements, ::Types::RequirementsManagement::RequirementType.connection_type, null: true,
description: 'Find requirements. Available only when feature flag `requirements_management` is enabled.',
description: 'Find requirements',
resolver: ::Resolvers::RequirementsManagement::RequirementsResolver
field :requirement_states_count, ::Types::RequirementsManagement::RequirementStatesCountType, null: true,
description: 'Number of requirements for the project by their state',
resolve: -> (project, args, ctx) do
return unless requirements_available?(project, ctx[:current_user])
return unless Ability.allowed?(ctx[:current_user], :read_requirement, project)
Hash.new(0).merge(project.requirements.counts_by_state)
end
......@@ -112,10 +112,6 @@ module EE
description: 'Cluster agents associated with the project',
resolver: ::Resolvers::Clusters::AgentsResolver
def self.requirements_available?(project, user)
::Feature.enabled?(:requirements_management, project, default_enabled: true) && Ability.allowed?(user, :read_requirement, project)
end
def self.sast_ci_configuration(project)
::Security::CiConfiguration::SastParserService.new(project).configuration
end
......
......@@ -24,7 +24,6 @@ module Mutations
def resolve(args)
project_path = args.delete(:project_path)
project = authorized_find!(full_path: project_path)
validate_flag!(project)
requirement = ::RequirementsManagement::CreateRequirementService.new(
project,
......@@ -40,12 +39,6 @@ module Mutations
private
def validate_flag!(project)
return if ::Feature.enabled?(:requirements_management, project, default_enabled: true)
raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'requirements_management flag is not enabled on this project'
end
def find_object(full_path:)
resolve_project(full_path: full_path)
end
......
......@@ -35,7 +35,6 @@ module Resolvers
# make sure it's loaded and not `nil` before continuing.
project = object.respond_to?(:sync) ? object.sync : object
return ::RequirementsManagement::Requirement.none if project.nil?
return ::RequirementsManagement::Requirement.none unless Feature.enabled?(:requirements_management, project, default_enabled: true)
args[:project_id] = project.id
args[:iids] ||= [args[:iid]].compact
......
- return unless Feature.enabled?(:requirements_management, project, default_enabled: true)
- return unless can?(current_user, :read_requirement, project)
= nav_link(path: 'requirements#index') do
......
---
name: requirements_management
introduced_by_url:
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/255285
group: group::certify
type: development
default_enabled: true
......@@ -26,18 +26,6 @@ RSpec.describe Projects::RequirementsManagement::RequirementsController do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
context 'when requirements_management flag is disabled' do
before do
stub_feature_flags(requirements_management: false)
end
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
context 'when feature is not available' do
......
......@@ -89,7 +89,6 @@ RSpec.describe 'Project navbar' do
context 'when requirements is available' do
before do
stub_licensed_features(requirements: true)
stub_feature_flags(requirements_management: true)
insert_after_nav_item(
_('Merge Requests'),
......
......@@ -26,7 +26,6 @@ RSpec.describe 'Requirements list', :js do
before do
stub_licensed_features(requirements: true)
stub_feature_flags(requirements_management: [project])
project.add_maintainer(user)
project.add_guest(user_guest)
......
......@@ -38,14 +38,6 @@ RSpec.describe Mutations::RequirementsManagement::CreateRequirement do
expect(subject[:requirement][:title]).to eq('foo')
expect(subject[:errors]).to be_empty
end
context 'when requirements_management flag is disabled' do
before do
stub_feature_flags(requirements_management: false)
end
it_behaves_like 'requirements not available'
end
end
context 'when requirements feature is disabled' do
......
......@@ -46,14 +46,6 @@ RSpec.describe Mutations::RequirementsManagement::UpdateRequirement do
)
expect(subject[:errors]).to be_empty
end
context 'when requirements_management flag is disabled' do
before do
stub_feature_flags(requirements_management: false)
end
it_behaves_like 'requirements not available'
end
end
context 'when requirements feature is disabled' do
......
......@@ -58,16 +58,6 @@ RSpec.describe Resolvers::RequirementsManagement::RequirementsResolver do
end
end
context 'when `requirements_management` flag is disabled' do
before do
stub_feature_flags(requirements_management: false)
end
it 'returns an empty list' do
expect(resolve_requirements).to be_empty
end
end
context 'with search' do
it 'filters requirements by title' do
requirements = resolve_requirements(search: 'kubernetes')
......
......@@ -70,15 +70,6 @@ RSpec.describe 'Creating a Requirement' do
expect { post_graphql_mutation(mutation, current_user: current_user) }.not_to change(RequirementsManagement::Requirement, :count)
end
end
context 'when requirements_management flag is dissabled' do
before do
stub_feature_flags(requirements_management: false)
end
it_behaves_like 'a mutation that returns top-level errors',
errors: ['requirements_management flag is not enabled on this project']
end
end
end
end
......@@ -83,14 +83,6 @@ RSpec.describe 'Updating a Requirement' do
it_behaves_like 'a mutation that returns top-level errors',
errors: ['title, state or last_test_report_state argument is required']
end
context 'when requirements_management flag is disabled' do
before do
stub_feature_flags(requirements_management: false)
end
it_behaves_like 'requirement update fails'
end
end
end
end
......@@ -54,14 +54,6 @@ RSpec.describe 'getting requirement counts for a project' do
expect(counts['opened']).to eq 1
expect(counts['archived']).to eq 1
end
context 'when requirements_management feature is disabled' do
before do
stub_feature_flags(requirements_management: false)
end
it_behaves_like 'nil requirement counts'
end
end
context 'when the user does not have access to the requirement' do
......
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