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-07-20 18:40:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 18:40:28 +0300
commitb595cb0c1dec83de5bdee18284abe86614bed33b (patch)
tree8c3d4540f193c5ff98019352f554e921b3a41a72 /app/assets/javascripts/batch_comments
parent2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff)
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'app/assets/javascripts/batch_comments')
-rw-r--r--app/assets/javascripts/batch_comments/components/draft_note.vue9
-rw-r--r--app/assets/javascripts/batch_comments/components/preview_dropdown.vue13
-rw-r--r--app/assets/javascripts/batch_comments/components/submit_dropdown.vue20
-rw-r--r--app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js6
4 files changed, 45 insertions, 3 deletions
diff --git a/app/assets/javascripts/batch_comments/components/draft_note.vue b/app/assets/javascripts/batch_comments/components/draft_note.vue
index 2b1ab911fbe..300a81caa5c 100644
--- a/app/assets/javascripts/batch_comments/components/draft_note.vue
+++ b/app/assets/javascripts/batch_comments/components/draft_note.vue
@@ -1,6 +1,7 @@
<script>
import { GlButton, GlSafeHtmlDirective, GlBadge } from '@gitlab/ui';
import { mapActions, mapGetters, mapState } from 'vuex';
+import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import NoteableNote from '~/notes/components/noteable_note.vue';
import PublishButton from './publish_button.vue';
@@ -14,6 +15,7 @@ export default {
directives: {
SafeHtml: GlSafeHtmlDirective,
},
+ mixins: [glFeatureFlagMixin()],
props: {
draft: {
type: Object,
@@ -92,6 +94,7 @@ export default {
:note="draft"
:line="line"
:discussion-root="true"
+ :class="{ 'gl-mb-0!': glFeatures.mrReviewSubmitComment }"
class="draft-note"
@handleEdit="handleEditing"
@cancelForm="handleNotEditing"
@@ -113,7 +116,11 @@ export default {
class="referenced-commands draft-note-commands"
></div>
- <p class="draft-note-actions d-flex" data-qa-selector="draft_note_content">
+ <p
+ v-if="!glFeatures.mrReviewSubmitComment"
+ class="draft-note-actions d-flex"
+ data-qa-selector="draft_note_content"
+ >
<publish-button
:show-count="true"
:should-publish="false"
diff --git a/app/assets/javascripts/batch_comments/components/preview_dropdown.vue b/app/assets/javascripts/batch_comments/components/preview_dropdown.vue
index f839056daf8..ba5cc0d1a76 100644
--- a/app/assets/javascripts/batch_comments/components/preview_dropdown.vue
+++ b/app/assets/javascripts/batch_comments/components/preview_dropdown.vue
@@ -2,6 +2,7 @@
import { GlDropdown, GlDropdownItem, GlIcon } from '@gitlab/ui';
import { mapActions, mapGetters, mapState } from 'vuex';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
+import { setUrlParams, visitUrl } from '~/lib/utils/url_utility';
import PreviewItem from './preview_item.vue';
import DraftsCount from './drafts_count.vue';
@@ -17,6 +18,7 @@ export default {
computed: {
...mapState('diffs', ['viewDiffsFileByFile']),
...mapGetters('batchComments', ['draftsCount', 'sortedDrafts']),
+ ...mapGetters(['getNoteableData']),
},
methods: {
...mapActions('diffs', ['setCurrentFileHash']),
@@ -24,12 +26,21 @@ export default {
isLast(index) {
return index === this.sortedDrafts.length - 1;
},
+ isOnLatestDiff(draft) {
+ return draft.position?.head_sha === this.getNoteableData.diff_head_sha;
+ },
async onClickDraft(draft) {
if (this.viewDiffsFileByFile && draft.file_hash) {
await this.setCurrentFileHash(draft.file_hash);
}
- await this.scrollToDraft(draft);
+ if (draft.position && !this.isOnLatestDiff(draft)) {
+ const url = new URL(setUrlParams({ commit_id: draft.position.head_sha }));
+ url.hash = `note_${draft.id}`;
+ visitUrl(url.toString());
+ } else {
+ await this.scrollToDraft(draft);
+ }
},
},
};
diff --git a/app/assets/javascripts/batch_comments/components/submit_dropdown.vue b/app/assets/javascripts/batch_comments/components/submit_dropdown.vue
index 5f4a1e44ea3..b070848cae9 100644
--- a/app/assets/javascripts/batch_comments/components/submit_dropdown.vue
+++ b/app/assets/javascripts/batch_comments/components/submit_dropdown.vue
@@ -22,6 +22,18 @@ export default {
computed: {
...mapGetters(['getNotesData', 'getNoteableData', 'noteableType', 'getCurrentUserLastNote']),
},
+ mounted() {
+ // We override the Bootstrap Vue click outside behaviour
+ // to allow for clicking in the autocomplete dropdowns
+ // without this override the submit dropdown will close
+ // whenever a item in the autocomplete dropdown is clicked
+ const originalClickOutHandler = this.$refs.dropdown.$refs.dropdown.clickOutHandler;
+ this.$refs.dropdown.$refs.dropdown.clickOutHandler = (e) => {
+ if (!e.target.closest('.atwho-container')) {
+ originalClickOutHandler(e);
+ }
+ };
+ },
methods: {
...mapActions('batchComments', ['publishReview']),
async submitReview() {
@@ -52,7 +64,13 @@ export default {
</script>
<template>
- <gl-dropdown right class="submit-review-dropdown" variant="info" category="secondary">
+ <gl-dropdown
+ ref="dropdown"
+ right
+ class="submit-review-dropdown"
+ variant="info"
+ category="secondary"
+ >
<template #button-content>
{{ __('Finish review') }}
<gl-icon class="dropdown-chevron" name="chevron-up" />
diff --git a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
index 908cbfd6dc8..a44b9827fe9 100644
--- a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
+++ b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
@@ -138,6 +138,12 @@ export const scrollToDraft = ({ dispatch, rootGetters }, draft) => {
window.mrTabs.tabShown(tab);
}
+ const { file_path: filePath } = draft;
+
+ if (filePath) {
+ dispatch('diffs/setFileCollapsedAutomatically', { filePath, collapsed: false }, { root: true });
+ }
+
if (discussion) {
dispatch('expandDiscussion', { discussionId: discussion.id }, { root: true });
}