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
a2da945a
Commit
a2da945a
authored
Sep 01, 2020
by
Tom Quirk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Abstract discussion scroll logic into method
parent
1f0b9525
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
app/assets/javascripts/design_management/components/design_notes/design_discussion.vue
..._management/components/design_notes/design_discussion.vue
+15
-11
No files found.
app/assets/javascripts/design_management/components/design_notes/design_discussion.vue
View file @
a2da945a
...
...
@@ -62,22 +62,14 @@ export default {
activeDiscussion
:
{
query
:
activeDiscussionQuery
,
result
({
data
})
{
const
activeDiscussionId
=
data
.
activeDiscussion
.
id
;
if
(
this
.
discussion
.
resolved
&&
!
this
.
resolvedDiscussionsExpanded
)
{
return
;
}
this
.
$nextTick
(()
=>
{
// We watch any changes to the active discussion from the design pins and scroll to this discussion if it exists
// We don't want scrollIntoView to be triggered from the discussion click itself
if
(
this
.
$el
&&
activeDiscussionId
&&
[
ACTIVE_DISCUSSION_SOURCE_TYPES
.
pin
,
ACTIVE_DISCUSSION_SOURCE_TYPES
.
url
].
includes
(
data
.
activeDiscussion
.
source
,
)
&&
activeDiscussionId
===
this
.
discussion
.
notes
[
0
].
id
)
{
// We watch any changes to the active discussion from the design pins and scroll to this discussion if it exists.
// We don't want scrollIntoView to be triggered from the discussion click itself.
if
(
this
.
$el
&&
this
.
shouldScrollToDiscussion
(
data
.
activeDiscussion
))
{
this
.
$el
.
scrollIntoView
({
behavior
:
'
smooth
'
,
inline
:
'
start
'
,
...
...
@@ -142,6 +134,18 @@ export default {
isFormVisible
()
{
return
this
.
isFormRendered
&&
this
.
discussionWithOpenForm
===
this
.
discussion
.
id
;
},
shouldScrollToDiscussion
(
activeDiscussion
)
{
const
ALLOWED_ACTIVE_DISCUSSION_SOURCES
=
[
ACTIVE_DISCUSSION_SOURCE_TYPES
.
pin
,
ACTIVE_DISCUSSION_SOURCE_TYPES
.
url
,
];
const
{
id
:
activeDiscussionId
,
source
:
activeDiscussionSource
}
=
activeDiscussion
;
return
(
ALLOWED_ACTIVE_DISCUSSION_SOURCES
.
includes
(
activeDiscussionSource
)
&&
activeDiscussionId
===
this
.
discussion
.
notes
[
0
].
id
);
},
},
methods
:
{
addDiscussionComment
(
...
...
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