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
7495140d
Commit
7495140d
authored
Mar 22, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand discussion when opening link to comment
Makes discussion expansion depend on `discussion.expanded`
parent
66054aeb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
25 deletions
+44
-25
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+10
-16
changelogs/unreleased/59352-fix-mr-discussion-expansion.yml
changelogs/unreleased/59352-fix-mr-discussion-expansion.yml
+5
-0
spec/features/merge_request/user_scrolls_to_note_on_load_spec.rb
...atures/merge_request/user_scrolls_to_note_on_load_spec.rb
+29
-9
No files found.
app/assets/javascripts/notes/components/noteable_discussion.vue
View file @
7495140d
...
...
@@ -87,13 +87,10 @@ export default {
},
},
data
()
{
const
{
diff_discussion
:
isDiffDiscussion
,
resolved
}
=
this
.
discussion
;
return
{
isReplying
:
false
,
isResolving
:
false
,
resolveAsThread
:
true
,
isRepliesCollapsed
:
Boolean
(
!
isDiffDiscussion
&&
resolved
),
};
},
computed
:
{
...
...
@@ -178,11 +175,11 @@ export default {
return
''
;
},
shouldShowDiscussions
()
{
const
{
expanded
,
resolved
}
=
this
.
discussion
;
const
isResolvedNonDiffDiscussion
=
!
this
.
discussion
.
diff_discussion
&&
resolved
;
return
expanded
||
this
.
alwaysExpanded
||
isResolvedNonDiffDiscussion
;
isExpanded
()
{
return
this
.
discussion
.
expanded
||
this
.
alwaysExpanded
;
},
shouldHideDiscussionBody
()
{
return
this
.
shouldRenderDiffs
&&
!
this
.
isExpanded
;
},
actionText
()
{
const
linkStart
=
`<a href="
${
_
.
escape
(
this
.
discussion
.
discussion_path
)}
">`
;
...
...
@@ -282,9 +279,6 @@ export default {
toggleDiscussionHandler
()
{
this
.
toggleDiscussion
({
discussionId
:
this
.
discussion
.
id
});
},
toggleReplies
()
{
this
.
isRepliesCollapsed
=
!
this
.
isRepliesCollapsed
;
},
showReplyForm
()
{
this
.
isReplying
=
true
;
},
...
...
@@ -405,7 +399,7 @@ Please check your network connection and try again.`;
/>
</div>
</div>
<div
v-if=
"
shouldShowDiscussions
"
class=
"discussion-body"
>
<div
v-if=
"
!shouldHideDiscussionBody
"
class=
"discussion-body"
>
<component
:is=
"wrapperComponent"
v-bind=
"wrapperComponentProps"
...
...
@@ -436,11 +430,11 @@ Please check your network connection and try again.`;
</component>
<toggle-replies-widget
v-if=
"hasReplies"
:collapsed=
"
isRepliesCollaps
ed"
:collapsed=
"
!isExpand
ed"
:replies=
"replies"
@
toggle=
"toggle
Replies
"
@
toggle=
"toggle
DiscussionHandler
"
/>
<template
v-if=
"
!isRepliesCollaps
ed"
>
<template
v-if=
"
isExpand
ed"
>
<component
:is=
"componentName(note)"
v-for=
"note in replies"
...
...
@@ -467,7 +461,7 @@ Please check your network connection and try again.`;
</
template
>
</ul>
<div
v-if=
"
!isRepliesCollaps
ed || !hasReplies"
v-if=
"
isExpand
ed || !hasReplies"
:class=
"{ 'is-replying': isReplying }"
class=
"discussion-reply-holder"
>
...
...
changelogs/unreleased/59352-fix-mr-discussion-expansion.yml
0 → 100644
View file @
7495140d
---
title
:
Expand resolved discussion when linking to a comment in the discussion
merge_request
:
26483
author
:
type
:
fixed
spec/features/merge_request/user_scrolls_to_note_on_load_spec.rb
View file @
7495140d
...
...
@@ -5,9 +5,7 @@ describe 'Merge request > User scrolls to note on load', :js do
let
(
:user
)
{
project
.
creator
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
author:
user
)
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
)
}
let
(
:resolved_note
)
{
create
(
:diff_note_on_merge_request
,
:resolved
,
noteable:
merge_request
,
project:
project
)
}
let
(
:fragment_id
)
{
"#note_
#{
note
.
id
}
"
}
let
(
:collapsed_fragment_id
)
{
"#note_
#{
resolved_note
.
id
}
"
}
before
do
sign_in
(
user
)
...
...
@@ -45,13 +43,35 @@ describe 'Merge request > User scrolls to note on load', :js do
end
end
# TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034
xit
'expands collapsed notes'
do
visit
"
#{
project_merge_request_path
(
project
,
merge_request
)
}#{
collapsed_fragment_id
}
"
note_element
=
find
(
collapsed_fragment_id
)
note_container
=
note_element
.
ancestor
(
'.timeline-content'
)
context
'resolved notes'
do
let
(
:collapsed_fragment_id
)
{
"#note_
#{
resolved_note
.
id
}
"
}
expect
(
note_element
.
visible?
).
to
eq
true
expect
(
note_container
.
find
(
'.line_content.noteable_line.old'
,
match: :first
).
visible?
).
to
eq
true
context
'when diff note'
do
let
(
:resolved_note
)
{
create
(
:diff_note_on_merge_request
,
:resolved
,
noteable:
merge_request
,
project:
project
)
}
it
'expands collapsed notes'
do
visit
"
#{
project_merge_request_path
(
project
,
merge_request
)
}#{
collapsed_fragment_id
}
"
note_element
=
find
(
collapsed_fragment_id
)
diff_container
=
note_element
.
ancestor
(
'.diff-content'
)
expect
(
note_element
.
visible?
).
to
eq
(
true
)
expect
(
diff_container
.
visible?
).
to
eq
(
true
)
end
end
context
'when non-diff note'
do
let
(
:non_diff_discussion
)
{
create
(
:discussion_note_on_merge_request
,
:resolved
,
noteable:
merge_request
,
project:
project
)
}
let
(
:resolved_note
)
{
create
(
:discussion_note_on_merge_request
,
:resolved
,
noteable:
merge_request
,
project:
project
,
in_reply_to:
non_diff_discussion
)
}
it
'expands collapsed replies'
do
visit
"
#{
project_merge_request_path
(
project
,
merge_request
)
}#{
collapsed_fragment_id
}
"
note_element
=
find
(
collapsed_fragment_id
)
expect
(
note_element
.
visible?
).
to
eq
(
true
)
expect
(
note_element
.
sibling
(
'.replies-toggle'
)[
:class
]).
to
include
(
'expanded'
)
end
end
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