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,57 +124,39 @@ describe Projects::BranchesController do ...@@ -124,57 +124,39 @@ describe Projects::BranchesController do
) )
end end
context 'create_confidential_merge_request feature is enabled' do context 'user cannot update issue' do
let(:issue) { create(:issue, project: confidential_issue_project) }
it 'does not post a system note' do
expect(SystemNoteService).not_to receive(:new_issue_branch)
create_branch_with_confidential_issue_project
end
end
context 'user can update issue' do
before do before do
stub_feature_flags(create_confidential_merge_request: true) confidential_issue_project.add_reporter(user)
end end
context 'user cannot update issue' do context 'issue is under the specified project' do
let(:issue) { create(:issue, project: confidential_issue_project) } let(:issue) { create(:issue, project: confidential_issue_project) }
it 'does not post a system note' do it 'posts a system note' do
expect(SystemNoteService).not_to receive(:new_issue_branch) expect(SystemNoteService).to receive(:new_issue_branch).with(issue, confidential_issue_project, user, "1-feature-branch", branch_project: project)
create_branch_with_confidential_issue_project create_branch_with_confidential_issue_project
end end
end end
context 'user can update issue' do context 'issue is not under the specified project' do
before do it 'does not post a system note' do
confidential_issue_project.add_reporter(user) expect(SystemNoteService).not_to receive(:new_issue_branch)
end
context 'issue is under the specified project' do
let(:issue) { create(:issue, project: confidential_issue_project) }
it 'posts a system note' do
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, confidential_issue_project, user, "1-feature-branch", branch_project: project)
create_branch_with_confidential_issue_project
end
end
context 'issue is not under the specified project' do
it 'does not post a system note' do
expect(SystemNoteService).not_to receive(:new_issue_branch)
create_branch_with_confidential_issue_project create_branch_with_confidential_issue_project
end
end end
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 end
context 'repository-less project' do context 'repository-less project' do
......
...@@ -1452,24 +1452,8 @@ describe Projects::IssuesController do ...@@ -1452,24 +1452,8 @@ 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 it 'creates a new merge request', :sidekiq_might_not_need_inline do
before do expect { create_merge_request }.to change(target_project.merge_requests, :count).by(1)
stub_feature_flags(create_confidential_merge_request: true)
end
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)
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
end end
......
...@@ -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