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
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
Show 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 {
...
@@ -87,13 +87,10 @@ export default {
},
},
},
},
data
()
{
data
()
{
const
{
diff_discussion
:
isDiffDiscussion
,
resolved
}
=
this
.
discussion
;
return
{
return
{
isReplying
:
false
,
isReplying
:
false
,
isResolving
:
false
,
isResolving
:
false
,
resolveAsThread
:
true
,
resolveAsThread
:
true
,
isRepliesCollapsed
:
Boolean
(
!
isDiffDiscussion
&&
resolved
),
};
};
},
},
computed
:
{
computed
:
{
...
@@ -178,11 +175,11 @@ export default {
...
@@ -178,11 +175,11 @@ export default {
return
''
;
return
''
;
},
},
shouldShowDiscussions
()
{
isExpanded
()
{
const
{
expanded
,
resolved
}
=
this
.
discussion
;
return
this
.
discussion
.
expanded
||
this
.
alwaysExpanded
;
const
isResolvedNonDiffDiscussion
=
!
this
.
discussion
.
diff_discussion
&&
resolved
;
},
shouldHideDiscussionBody
()
{
return
expanded
||
this
.
alwaysExpanded
||
isResolvedNonDiffDiscussion
;
return
this
.
shouldRenderDiffs
&&
!
this
.
isExpanded
;
},
},
actionText
()
{
actionText
()
{
const
linkStart
=
`<a href="
${
_
.
escape
(
this
.
discussion
.
discussion_path
)}
">`
;
const
linkStart
=
`<a href="
${
_
.
escape
(
this
.
discussion
.
discussion_path
)}
">`
;
...
@@ -282,9 +279,6 @@ export default {
...
@@ -282,9 +279,6 @@ export default {
toggleDiscussionHandler
()
{
toggleDiscussionHandler
()
{
this
.
toggleDiscussion
({
discussionId
:
this
.
discussion
.
id
});
this
.
toggleDiscussion
({
discussionId
:
this
.
discussion
.
id
});
},
},
toggleReplies
()
{
this
.
isRepliesCollapsed
=
!
this
.
isRepliesCollapsed
;
},
showReplyForm
()
{
showReplyForm
()
{
this
.
isReplying
=
true
;
this
.
isReplying
=
true
;
},
},
...
@@ -405,7 +399,7 @@ Please check your network connection and try again.`;
...
@@ -405,7 +399,7 @@ Please check your network connection and try again.`;
/>
/>
</div>
</div>
</div>
</div>
<div
v-if=
"
shouldShowDiscussions
"
class=
"discussion-body"
>
<div
v-if=
"
!shouldHideDiscussionBody
"
class=
"discussion-body"
>
<component
<component
:is=
"wrapperComponent"
:is=
"wrapperComponent"
v-bind=
"wrapperComponentProps"
v-bind=
"wrapperComponentProps"
...
@@ -436,11 +430,11 @@ Please check your network connection and try again.`;
...
@@ -436,11 +430,11 @@ Please check your network connection and try again.`;
</component>
</component>
<toggle-replies-widget
<toggle-replies-widget
v-if=
"hasReplies"
v-if=
"hasReplies"
:collapsed=
"
isRepliesCollaps
ed"
:collapsed=
"
!isExpand
ed"
:replies=
"replies"
:replies=
"replies"
@
toggle=
"toggle
Replies
"
@
toggle=
"toggle
DiscussionHandler
"
/>
/>
<template
v-if=
"
!isRepliesCollaps
ed"
>
<template
v-if=
"
isExpand
ed"
>
<component
<component
:is=
"componentName(note)"
:is=
"componentName(note)"
v-for=
"note in replies"
v-for=
"note in replies"
...
@@ -467,7 +461,7 @@ Please check your network connection and try again.`;
...
@@ -467,7 +461,7 @@ Please check your network connection and try again.`;
</
template
>
</
template
>
</ul>
</ul>
<div
<div
v-if=
"
!isRepliesCollaps
ed || !hasReplies"
v-if=
"
isExpand
ed || !hasReplies"
:class=
"{ 'is-replying': isReplying }"
:class=
"{ 'is-replying': isReplying }"
class=
"discussion-reply-holder"
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
...
@@ -5,9 +5,7 @@ describe 'Merge request > User scrolls to note on load', :js do
let
(
:user
)
{
project
.
creator
}
let
(
:user
)
{
project
.
creator
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
author:
user
)
}
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
(
: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
(
:fragment_id
)
{
"#note_
#{
note
.
id
}
"
}
let
(
:collapsed_fragment_id
)
{
"#note_
#{
resolved_note
.
id
}
"
}
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
...
@@ -45,13 +43,35 @@ describe 'Merge request > User scrolls to note on load', :js do
...
@@ -45,13 +43,35 @@ describe 'Merge request > User scrolls to note on load', :js do
end
end
end
end
# TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034
context
'resolved notes'
do
xit
'expands collapsed notes'
do
let
(
:collapsed_fragment_id
)
{
"#note_
#{
resolved_note
.
id
}
"
}
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
}
"
visit
"
#{
project_merge_request_path
(
project
,
merge_request
)
}#{
collapsed_fragment_id
}
"
note_element
=
find
(
collapsed_fragment_id
)
note_element
=
find
(
collapsed_fragment_id
)
note_container
=
note_element
.
ancestor
(
'.timeline
-content'
)
diff_container
=
note_element
.
ancestor
(
'.diff
-content'
)
expect
(
note_element
.
visible?
).
to
eq
true
expect
(
note_element
.
visible?
).
to
eq
(
true
)
expect
(
note_container
.
find
(
'.line_content.noteable_line.old'
,
match: :first
).
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
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