Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-15 15:09:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-15 15:09:24 +0300
commit7912017a137da35c48071a048c99d27737c29f0f (patch)
treed967751ff35db3fb9ca788a36982a3f1f25bed92 /app/assets/javascripts/notes
parent25fdad39f53eb46b346076fd07bc2db9bc1d8ccb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r--app/assets/javascripts/notes/components/notes_app.vue12
-rw-r--r--app/assets/javascripts/notes/mixins/discussion_navigation.js14
2 files changed, 25 insertions, 1 deletions
diff --git a/app/assets/javascripts/notes/components/notes_app.vue b/app/assets/javascripts/notes/components/notes_app.vue
index 9c2ff2c3e7f..7bb1a1a1bfe 100644
--- a/app/assets/javascripts/notes/components/notes_app.vue
+++ b/app/assets/javascripts/notes/components/notes_app.vue
@@ -126,6 +126,9 @@ export default {
slotKeys() {
return this.sortDirDesc ? ['form', 'comments'] : ['comments', 'form'];
},
+ isAppReady() {
+ return !this.isLoading && !this.renderSkeleton && this.shouldShow;
+ },
},
watch: {
async isFetching() {
@@ -149,6 +152,15 @@ export default {
this.discussionsCount.textContent = val;
}
},
+ isAppReady: {
+ handler(isReady) {
+ if (!isReady) return;
+ this.$nextTick(() => {
+ window.mrTabs?.eventHub.$emit('NotesAppReady');
+ });
+ },
+ immediate: true,
+ },
},
created() {
this.discussionsCount = document.querySelector('.js-discussions-count');
diff --git a/app/assets/javascripts/notes/mixins/discussion_navigation.js b/app/assets/javascripts/notes/mixins/discussion_navigation.js
index c4d542083bd..3dbcf28d11c 100644
--- a/app/assets/javascripts/notes/mixins/discussion_navigation.js
+++ b/app/assets/javascripts/notes/mixins/discussion_navigation.js
@@ -1,8 +1,12 @@
import { mapGetters, mapActions, mapState } from 'vuex';
import { scrollToElement, contentTop } from '~/lib/utils/common_utils';
+function isOverviewPage() {
+ return window.mrTabs?.currentAction === 'show';
+}
+
function getAllDiscussionElements() {
- const containerEl = window.mrTabs?.currentAction === 'diffs' ? '.diffs' : '.tab-pane.notes';
+ const containerEl = isOverviewPage() ? '.tab-pane.notes' : '.diffs';
return Array.from(
document.querySelectorAll(
`${containerEl} div[data-discussion-id]:not([data-discussion-resolved])`,
@@ -59,6 +63,14 @@ function getPreviousDiscussion() {
function handleJumpForBothPages(getDiscussion, ctx, fn, scrollOptions) {
const discussion = getDiscussion();
+ if (!isOverviewPage() && !discussion) {
+ window.mrTabs?.eventHub.$once('NotesAppReady', () => {
+ handleJumpForBothPages(getDiscussion, ctx, fn, scrollOptions);
+ });
+ window.mrTabs?.setCurrentAction('show');
+ window.mrTabs?.tabShown('show', undefined, false);
+ return;
+ }
const id = discussion.dataset.discussionId;
ctx.expandDiscussion({ discussionId: id });
scrollToElement(discussion, scrollOptions);