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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
4c31455a
Commit
4c31455a
authored
Nov 06, 2017
by
George Andrinopoulos
Committed by
Rémy Coutable
Nov 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove create MR button from issues when MRs are disabled
parent
1e94172e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
11 deletions
+34
-11
app/views/projects/issues/_new_branch.html.haml
app/views/projects/issues/_new_branch.html.haml
+16
-11
changelogs/unreleased/38247-hide-create-mr-button-in-issue-show.yml
.../unreleased/38247-hide-create-mr-button-in-issue-show.yml
+5
-0
spec/features/issues/create_branch_merge_request_spec.rb
spec/features/issues/create_branch_merge_request_spec.rb
+13
-0
No files found.
app/views/projects/issues/_new_branch.html.haml
View file @
4c31455a
-
can_create_merge_request
=
can?
(
current_user
,
:create_merge_request
,
@project
)
-
data_action
=
can_create_merge_request
?
'create-mr'
:
'create-branch'
-
value
=
can_create_merge_request
?
'Create a merge request'
:
'Create a branch'
-
if
can?
(
current_user
,
:push_code
,
@project
)
.create-mr-dropdown-wrap
{
data:
{
can_create_path:
can_create_branch_project_issue_path
(
@project
,
@issue
),
create_mr_path:
create_merge_request_project_issue_path
(
@project
,
@issue
),
create_branch_path:
project_branches_path
(
@project
,
branch_name:
@issue
.
to_branch_name
,
issue_iid:
@issue
.
iid
)
}
}
.btn-group.unavailable
...
...
@@ -6,10 +10,11 @@
%span
.text
Checking branch availability…
.btn-group.available.hide
%input
.btn.js-create-merge-request.btn-inverted.btn-success
{
type:
'button'
,
value:
'Create a merge request'
,
data:
{
action:
'create-mr'
}
}
%input
.btn.js-create-merge-request.btn-inverted.btn-success
{
type:
'button'
,
value:
value
,
data:
{
action:
data_action
}
}
%button
.btn.btn-inverted.dropdown-toggle.btn-inverted.btn-success.js-dropdown-toggle
{
type:
'button'
,
data:
{
'dropdown-trigger'
=>
'#create-merge-request-dropdown'
}
}
=
icon
(
'caret-down'
)
%ul
#create-merge-request-dropdown
.dropdown-menu.dropdown-menu-align-right
{
data:
{
dropdown:
true
}
}
-
if
can_create_merge_request
%li
.droplab-item-selected
{
role:
'button'
,
data:
{
value:
'create-mr'
,
'text'
=>
'Create a merge request'
}
}
.menu-item
.icon-container
...
...
@@ -19,7 +24,7 @@
%span
Creates a merge request named after this issue, with source branch created from '
#{
@project
.
default_branch
}
'.
%li
.divider.droplab-item-ignore
%li
{
role:
'button'
,
data:
{
value:
'create-branch'
,
'text'
=>
'Create a branch'
}
}
%li
{
class:
[
!
can_create_merge_request
&&
'droplab-item-selected'
],
role:
'button'
,
data:
{
value:
'create-branch'
,
'text'
=>
'Create a branch'
}
}
.menu-item
.icon-container
=
icon
(
'check'
)
...
...
changelogs/unreleased/38247-hide-create-mr-button-in-issue-show.yml
0 → 100644
View file @
4c31455a
---
title
:
Remove create MR button from issues when MRs are disabled
merge_request
:
15071
author
:
George Andrinopoulos
type
:
fixed
spec/features/issues/create_branch_merge_request_spec.rb
View file @
4c31455a
...
...
@@ -64,6 +64,19 @@ feature 'Create Branch/Merge Request Dropdown on issue page', :feature, :js do
end
end
context
'when merge requests are disabled'
do
before
do
project
.
project_feature
.
update
(
merge_requests_access_level:
0
)
visit
project_issue_path
(
project
,
issue
)
end
it
'shows only create branch button'
do
expect
(
page
).
not_to
have_button
(
'Create a merge request'
)
expect
(
page
).
to
have_button
(
'Create a branch'
)
end
end
context
'when issue is confidential'
do
it
'disables the create branch button'
do
issue
=
create
(
:issue
,
:confidential
,
project:
project
)
...
...
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