Commit 4f2b8f90 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'remove-create_confidential_merge_request' into 'master'

Removes create_confidential_merge_request feature flag

See merge request gitlab-org/gitlab!31968
parents 10d20285 a692c1b8
...@@ -186,7 +186,6 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -186,7 +186,6 @@ class Projects::BranchesController < Projects::ApplicationController
end end
def confidential_issue_project def confidential_issue_project
return unless helpers.create_confidential_merge_request_enabled?
return if params[:confidential_issue_project_id].blank? return if params[:confidential_issue_project_id].blank?
confidential_issue_project = Project.find(params[:confidential_issue_project_id]) confidential_issue_project = Project.find(params[:confidential_issue_project_id])
......
...@@ -187,7 +187,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -187,7 +187,7 @@ class Projects::IssuesController < Projects::ApplicationController
def create_merge_request def create_merge_request
create_params = params.slice(:branch_name, :ref).merge(issue_iid: issue.iid) create_params = params.slice(:branch_name, :ref).merge(issue_iid: issue.iid)
create_params[:target_project_id] = params[:target_project_id] if helpers.create_confidential_merge_request_enabled? create_params[:target_project_id] = params[:target_project_id]
result = ::MergeRequests::CreateFromIssueService.new(project, current_user, create_params).execute result = ::MergeRequests::CreateFromIssueService.new(project, current_user, create_params).execute
if result[:status] == :success if result[:status] == :success
......
...@@ -138,17 +138,12 @@ module IssuesHelper ...@@ -138,17 +138,12 @@ module IssuesHelper
can?(current_user, :create_issue, project) can?(current_user, :create_issue, project)
end end
def create_confidential_merge_request_enabled?
Feature.enabled?(:create_confidential_merge_request, @project, default_enabled: true)
end
def show_new_branch_button? def show_new_branch_button?
can_create_confidential_merge_request? || !@issue.confidential? can_create_confidential_merge_request? || !@issue.confidential?
end end
def can_create_confidential_merge_request? def can_create_confidential_merge_request?
@issue.confidential? && !@project.private? && @issue.confidential? && !@project.private? &&
create_confidential_merge_request_enabled? &&
can?(current_user, :create_merge_request_in, @project) can?(current_user, :create_merge_request_in, @project)
end end
......
---
title: Removes create_confidential_merge_request feature flag leandrogs
merge_request: 31968
author: Leandro Silva
type: other
...@@ -124,11 +124,6 @@ describe Projects::BranchesController do ...@@ -124,11 +124,6 @@ describe Projects::BranchesController do
) )
end end
context 'create_confidential_merge_request feature is enabled' do
before do
stub_feature_flags(create_confidential_merge_request: true)
end
context 'user cannot update issue' do context 'user cannot update issue' do
let(:issue) { create(:issue, project: confidential_issue_project) } let(:issue) { create(:issue, project: confidential_issue_project) }
...@@ -164,19 +159,6 @@ describe Projects::BranchesController do ...@@ -164,19 +159,6 @@ describe Projects::BranchesController do
end end
end end
context 'create_confidential_merge_request feature is disabled' do
before do
stub_feature_flags(create_confidential_merge_request: false)
end
it 'posts a system note on project' do
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch", branch_project: project)
create_branch_with_confidential_issue_project
end
end
end
context 'repository-less project' do context 'repository-less project' do
let(:project) { create :project } let(:project) { create :project }
......
...@@ -1452,27 +1452,11 @@ describe Projects::IssuesController do ...@@ -1452,27 +1452,11 @@ describe Projects::IssuesController do
let(:target_project) { fork_project(project, user, repository: true) } let(:target_project) { fork_project(project, user, repository: true) }
let(:target_project_id) { target_project.id } let(:target_project_id) { target_project.id }
context 'create_confidential_merge_request feature is enabled' do
before do
stub_feature_flags(create_confidential_merge_request: true)
end
it 'creates a new merge request', :sidekiq_might_not_need_inline do it 'creates a new merge request', :sidekiq_might_not_need_inline do
expect { create_merge_request }.to change(target_project.merge_requests, :count).by(1) expect { create_merge_request }.to change(target_project.merge_requests, :count).by(1)
end end
end end
context 'create_confidential_merge_request feature is disabled' do
before do
stub_feature_flags(create_confidential_merge_request: false)
end
it 'creates a new merge request' do
expect { create_merge_request }.to change(project.merge_requests, :count).by(1)
end
end
end
def create_merge_request def create_merge_request
post( post(
:create_merge_request, :create_merge_request,
......
...@@ -164,17 +164,7 @@ describe 'User creates branch and merge request on issue page', :js do ...@@ -164,17 +164,7 @@ describe 'User creates branch and merge request on issue page', :js do
context 'when issue is confidential' do context 'when issue is confidential' do
let(:issue) { create(:issue, :confidential, project: project) } let(:issue) { create(:issue, :confidential, project: project) }
it 'disables the create branch button' do it 'enables the create branch button' do
stub_feature_flags(create_confidential_merge_request: false)
visit project_issue_path(project, issue)
expect(page).not_to have_css('.create-mr-dropdown-wrap')
end
it 'enables the create branch button when feature flag is enabled' do
stub_feature_flags(create_confidential_merge_request: true)
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
expect(page).to have_css('.create-mr-dropdown-wrap') expect(page).to have_css('.create-mr-dropdown-wrap')
......
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