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
d403d7ac
Commit
d403d7ac
authored
Jan 08, 2019
by
Douglas Barbosa Alexandre
Committed by
Robert Speicher
Jan 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MR sidebar to correctly warning if assignee can't merge
parent
1b3affaf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
6 deletions
+35
-6
app/views/shared/issuable/_sidebar_assignees.html.haml
app/views/shared/issuable/_sidebar_assignees.html.haml
+1
-1
spec/views/projects/merge_requests/show.html.haml_spec.rb
spec/views/projects/merge_requests/show.html.haml_spec.rb
+34
-5
No files found.
app/views/shared/issuable/_sidebar_assignees.html.haml
View file @
d403d7ac
...
...
@@ -25,7 +25,7 @@
.value.hide-collapsed
-
if
issuable_sidebar
[
:assignee
]
=
link_to_member
(
@project
,
assignee
,
size:
32
,
extra_class:
'bold'
)
do
-
if
issuable_sidebar
[
:assignee
][
:can_merge
]
-
unless
issuable_sidebar
[
:assignee
][
:can_merge
]
%span
.float-right.cannot-be-merged
{
data:
{
toggle:
'tooltip'
,
placement:
'left'
},
title:
_
(
'Not allowed to merge'
)
}
=
icon
(
'exclamation-triangle'
,
'aria-hidden'
:
'true'
)
%span
.username
...
...
spec/views/projects/merge_requests/show.html.haml_spec.rb
View file @
d403d7ac
...
...
@@ -32,11 +32,7 @@ describe 'projects/merge_requests/show.html.haml' do
assign
(
:noteable
,
closed_merge_request
)
assign
(
:notes
,
[])
assign
(
:pipelines
,
Ci
::
Pipeline
.
none
)
assign
(
:issuable_sidebar
,
MergeRequestSerializer
.
new
(
current_user:
user
,
project:
project
)
.
represent
(
closed_merge_request
,
serializer:
'sidebar'
)
)
assign
(
:issuable_sidebar
,
serialize_issuable_sidebar
(
user
,
project
,
closed_merge_request
))
preload_view_requirements
...
...
@@ -45,6 +41,33 @@ describe 'projects/merge_requests/show.html.haml' do
current_application_settings:
Gitlab
::
CurrentSettings
.
current_application_settings
)
end
describe
'merge request assignee sidebar'
do
context
'when assignee is allowed to merge'
do
it
'does not show a warning icon'
do
closed_merge_request
.
update
(
assignee_id:
user
.
id
)
project
.
add_maintainer
(
user
)
assign
(
:issuable_sidebar
,
serialize_issuable_sidebar
(
user
,
project
,
closed_merge_request
))
render
expect
(
rendered
).
not_to
have_css
(
'.cannot-be-merged'
)
end
end
context
'when assignee is not allowed to merge'
do
it
'shows a warning icon'
do
reporter
=
create
(
:user
)
project
.
add_reporter
(
reporter
)
closed_merge_request
.
update
(
assignee_id:
reporter
.
id
)
assign
(
:issuable_sidebar
,
serialize_issuable_sidebar
(
user
,
project
,
closed_merge_request
))
render
expect
(
rendered
).
to
have_css
(
'.cannot-be-merged'
)
end
end
end
context
'when the merge request is closed'
do
it
'shows the "Reopen" button'
do
render
...
...
@@ -80,4 +103,10 @@ describe 'projects/merge_requests/show.html.haml' do
expect
(
rendered
).
to
have_css
(
'a'
,
visible:
false
,
text:
'Close'
)
end
end
def
serialize_issuable_sidebar
(
user
,
project
,
merge_request
)
MergeRequestSerializer
.
new
(
current_user:
user
,
project:
project
)
.
represent
(
closed_merge_request
,
serializer:
'sidebar'
)
end
end
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