Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a692c1b8
Commit
a692c1b8
authored
May 14, 2020
by
Leandro Gomes
Committed by
Phil Hughes
May 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes create_confidential_merge_request feature flag
parent
3f82d382
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
73 deletions
+28
-73
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+0
-1
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+0
-5
changelogs/unreleased/remove-create_confidential_merge_request.yml
...s/unreleased/remove-create_confidential_merge_request.yml
+5
-0
spec/controllers/projects/branches_controller_spec.rb
spec/controllers/projects/branches_controller_spec.rb
+19
-37
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+2
-18
spec/features/issues/user_creates_branch_and_merge_request_spec.rb
...ures/issues/user_creates_branch_and_merge_request_spec.rb
+1
-11
No files found.
app/controllers/projects/branches_controller.rb
View file @
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
])
...
...
app/controllers/projects/issues_controller.rb
View file @
a692c1b8
...
@@ -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
...
...
app/helpers/issues_helper.rb
View file @
a692c1b8
...
@@ -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
...
...
changelogs/unreleased/remove-create_confidential_merge_request.yml
0 → 100644
View file @
a692c1b8
---
title
:
Removes create_confidential_merge_request feature flag leandrogs
merge_request
:
31968
author
:
Leandro Silva
type
:
other
spec/controllers/projects/branches_controller_spec.rb
View file @
a692c1b8
...
@@ -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
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
a692c1b8
...
@@ -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
...
...
spec/features/issues/user_creates_branch_and_merge_request_spec.rb
View file @
a692c1b8
...
@@ -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'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment