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
end
def confidential_issue_project
return unless helpers.create_confidential_merge_request_enabled?
return if params[:confidential_issue_project_id].blank?
confidential_issue_project = Project.find(params[:confidential_issue_project_id])
......
......@@ -187,7 +187,7 @@ class Projects::IssuesController < Projects::ApplicationController
def create_merge_request
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
if result[:status] == :success
......
......@@ -138,17 +138,12 @@ module IssuesHelper
can?(current_user, :create_issue, project)
end
def create_confidential_merge_request_enabled?
Feature.enabled?(:create_confidential_merge_request, @project, default_enabled: true)
end
def show_new_branch_button?
can_create_confidential_merge_request? || !@issue.confidential?
end
def can_create_confidential_merge_request?
@issue.confidential? && !@project.private? &&
create_confidential_merge_request_enabled? &&
can?(current_user, :create_merge_request_in, @project)
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
)
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
stub_feature_flags(create_confidential_merge_request: true)
confidential_issue_project.add_reporter(user)
end
context 'user cannot update issue' do
context 'issue is under the specified project' 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)
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 'user can update issue' do
before do
confidential_issue_project.add_reporter(user)
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)
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
end
create_branch_with_confidential_issue_project
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
......
......@@ -1452,24 +1452,8 @@ describe Projects::IssuesController do
let(:target_project) { fork_project(project, user, repository: true) }
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
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
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
......
......@@ -164,17 +164,7 @@ describe 'User creates branch and merge request on issue page', :js do
context 'when issue is confidential' do
let(:issue) { create(:issue, :confidential, project: project) }
it 'disables 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)
it 'enables the create branch button' do
visit project_issue_path(project, issue)
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