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
dc510fbf
Commit
dc510fbf
authored
Aug 27, 2020
by
Tom Quirk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call scrollIntoView for note on next tick
Also, add a `url` source for active discussion in Apollo
parent
feaae37e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
22 deletions
+34
-22
app/assets/javascripts/design_management/components/design_notes/design_discussion.vue
..._management/components/design_notes/design_discussion.vue
+18
-13
app/assets/javascripts/design_management/components/design_notes/design_note.vue
...design_management/components/design_notes/design_note.vue
+5
-3
app/assets/javascripts/design_management/constants.js
app/assets/javascripts/design_management/constants.js
+1
-0
app/assets/javascripts/design_management/pages/design/index.vue
...sets/javascripts/design_management/pages/design/index.vue
+3
-3
spec/frontend/design_management/components/design_notes/design_note_spec.js
...gn_management/components/design_notes/design_note_spec.js
+3
-1
spec/frontend/design_management/pages/design/index_spec.js
spec/frontend/design_management/pages/design/index_spec.js
+1
-1
spec/frontend/design_management/pages/index_spec.js
spec/frontend/design_management/pages/index_spec.js
+3
-1
No files found.
app/assets/javascripts/design_management/components/design_notes/design_discussion.vue
View file @
dc510fbf
...
...
@@ -66,19 +66,24 @@ export default {
if
(
this
.
discussion
.
resolved
&&
!
this
.
resolvedDiscussionsExpanded
)
{
return
;
}
// 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
&&
data
.
activeDiscussion
.
source
===
ACTIVE_DISCUSSION_SOURCE_TYPES
.
pin
&&
activeDiscussionId
===
this
.
discussion
.
notes
[
0
].
id
)
{
this
.
$el
.
scrollIntoView
({
behavior
:
'
smooth
'
,
inline
:
'
start
'
,
});
}
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
)
{
this
.
$el
.
scrollIntoView
({
behavior
:
'
smooth
'
,
inline
:
'
start
'
,
});
}
});
},
},
},
...
...
app/assets/javascripts/design_management/components/design_notes/design_note.vue
View file @
dc510fbf
...
...
@@ -60,9 +60,11 @@ export default {
},
},
mounted
()
{
if
(
this
.
isNoteLinked
)
{
this
.
$el
.
scrollIntoView
({
behavior
:
'
smooth
'
,
inline
:
'
start
'
});
}
this
.
$nextTick
(()
=>
{
if
(
this
.
isNoteLinked
)
{
this
.
$el
.
scrollIntoView
({
behavior
:
'
smooth
'
,
inline
:
'
start
'
});
}
});
},
methods
:
{
hideForm
()
{
...
...
app/assets/javascripts/design_management/constants.js
View file @
dc510fbf
...
...
@@ -11,6 +11,7 @@ export const VALID_DATA_TRANSFER_TYPE = 'Files';
export
const
ACTIVE_DISCUSSION_SOURCE_TYPES
=
{
pin
:
'
pin
'
,
discussion
:
'
discussion
'
,
url
:
'
url
'
,
};
export
const
DESIGN_DETAIL_LAYOUT_CLASSLIST
=
[
'
design-detail-layout
'
,
'
overflow-hidden
'
,
'
m-0
'
];
app/assets/javascripts/design_management/pages/design/index.vue
View file @
dc510fbf
...
...
@@ -271,19 +271,19 @@ export default {
this
.
isLatestVersion
,
);
},
updateActiveDiscussion
(
id
)
{
updateActiveDiscussion
(
id
,
source
=
ACTIVE_DISCUSSION_SOURCE_TYPES
.
discussion
)
{
this
.
$apollo
.
mutate
({
mutation
:
updateActiveDiscussionMutation
,
variables
:
{
id
,
source
:
ACTIVE_DISCUSSION_SOURCE_TYPES
.
discussion
,
source
,
},
});
},
updateActiveDiscussionFromUrl
()
{
const
noteId
=
parseDesignRouteHash
(
this
.
$route
.
hash
);
const
diffNoteGid
=
noteId
?
toDiffNoteGid
(
noteId
)
:
undefined
;
return
this
.
updateActiveDiscussion
(
diffNoteGid
);
return
this
.
updateActiveDiscussion
(
diffNoteGid
,
ACTIVE_DISCUSSION_SOURCE_TYPES
.
url
);
},
toggleResolvedComments
()
{
this
.
resolvedDiscussionsExpanded
=
!
this
.
resolvedDiscussionsExpanded
;
...
...
spec/frontend/design_management/components/design_notes/design_note_spec.js
View file @
dc510fbf
...
...
@@ -91,7 +91,9 @@ describe('Design note component', () => {
note
,
});
expect
(
scrollIntoViewMock
).
toHaveBeenCalled
();
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
scrollIntoViewMock
).
toHaveBeenCalled
();
});
});
it
(
'
should not render edit icon when user does not have a permission
'
,
()
=>
{
...
...
spec/frontend/design_management/pages/design/index_spec.js
View file @
dc510fbf
...
...
@@ -315,7 +315,7 @@ describe('Design management design index page', () => {
expect
(
mutate
).
toHaveBeenCalledTimes
(
1
);
expect
(
mutate
).
toHaveBeenCalledWith
({
mutation
:
updateActiveDiscussion
,
variables
:
{
id
:
'
gid://gitlab/DiffNote/123
'
,
source
:
'
discussion
'
},
variables
:
{
id
:
'
gid://gitlab/DiffNote/123
'
,
source
:
'
url
'
},
});
});
});
...
...
spec/frontend/design_management/pages/index_spec.js
View file @
dc510fbf
...
...
@@ -579,7 +579,9 @@ describe('Design management index page', () => {
});
createComponent
(
true
);
expect
(
scrollIntoViewMock
).
toHaveBeenCalled
();
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
scrollIntoViewMock
).
toHaveBeenCalled
();
});
});
});
});
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