summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes/mixins
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-26 12:11:48 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-26 12:11:48 +0000
commit93c1e0e4c231b0b13000a587a6949067ef7fb128 (patch)
tree16dec1d8bef643a91e1f1ddba5bba99abd377203 /app/assets/javascripts/notes/mixins
parent7adf8749c2864ae56ffb3ed89ffbe20e9320683a (diff)
downloadgitlab-ce-93c1e0e4c231b0b13000a587a6949067ef7fb128.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/notes/mixins')
-rw-r--r--app/assets/javascripts/notes/mixins/discussion_navigation.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/assets/javascripts/notes/mixins/discussion_navigation.js b/app/assets/javascripts/notes/mixins/discussion_navigation.js
index 10c897d2d2a..db5f9ebf3f0 100644
--- a/app/assets/javascripts/notes/mixins/discussion_navigation.js
+++ b/app/assets/javascripts/notes/mixins/discussion_navigation.js
@@ -7,13 +7,14 @@ import eventHub from '../event_hub';
* @param {string} selector
* @returns {boolean}
*/
-function scrollTo(selector, { withoutContext = false } = {}) {
+function scrollTo(selector, { withoutContext = false, offset = 0 } = {}) {
const el = document.querySelector(selector);
const scrollFunction = withoutContext ? scrollToElement : scrollToElementWithContext;
if (el) {
scrollFunction(el, {
behavior: 'auto',
+ offset,
});
return true;
}
@@ -67,7 +68,10 @@ function diffsJump({ expandDiscussion }, id, firstNoteId) {
function discussionJump({ expandDiscussion }, id) {
const selector = `div.discussion[data-discussion-id="${id}"]`;
expandDiscussion({ discussionId: id });
- return scrollTo(selector, { withoutContext: true });
+ return scrollTo(selector, {
+ withoutContext: true,
+ offset: window.gon?.features?.movedMrSidebar ? -28 : 0,
+ });
}
/**