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>2021-03-16 21:18:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 21:18:33 +0300
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /app/assets/javascripts/batch_comments
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'app/assets/javascripts/batch_comments')
-rw-r--r--app/assets/javascripts/batch_comments/components/publish_button.vue3
-rw-r--r--app/assets/javascripts/batch_comments/components/review_bar.vue5
-rw-r--r--app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js22
3 files changed, 20 insertions, 10 deletions
diff --git a/app/assets/javascripts/batch_comments/components/publish_button.vue b/app/assets/javascripts/batch_comments/components/publish_button.vue
index 8568dba5947..2a7be605003 100644
--- a/app/assets/javascripts/batch_comments/components/publish_button.vue
+++ b/app/assets/javascripts/batch_comments/components/publish_button.vue
@@ -40,7 +40,8 @@ export default {
<template>
<gl-button
:loading="isPublishing"
- class="js-publish-draft-button qa-submit-review"
+ class="js-publish-draft-button"
+ data-qa-selector="submit_review_button"
:category="category"
:variant="variant"
@click="onClick"
diff --git a/app/assets/javascripts/batch_comments/components/review_bar.vue b/app/assets/javascripts/batch_comments/components/review_bar.vue
index 035d6f4e0ab..9ffc5ee34cf 100644
--- a/app/assets/javascripts/batch_comments/components/review_bar.vue
+++ b/app/assets/javascripts/batch_comments/components/review_bar.vue
@@ -27,7 +27,10 @@ export default {
<template>
<div v-show="draftsCount > 0">
<nav class="review-bar-component">
- <div class="review-bar-content qa-review-bar d-flex gl-justify-content-end">
+ <div
+ class="review-bar-content d-flex gl-justify-content-end"
+ data-qa-selector="review_bar_content"
+ >
<preview-dropdown />
<publish-button class="gl-ml-3" show-count />
</div>
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 36fef06eeff..88be64d0a1a 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
@@ -1,3 +1,4 @@
+import { isEmpty } from 'lodash';
import { deprecatedCreateFlash as flash } from '~/flash';
import { scrollToElement } from '~/lib/utils/common_utils';
import { __ } from '~/locale';
@@ -88,18 +89,23 @@ export const updateDiscussionsAfterPublish = async ({ dispatch, getters, rootGet
export const updateDraft = (
{ commit, getters },
{ note, noteText, resolveDiscussion, position, callback },
-) =>
- service
- .update(getters.getNotesData.draftsPath, {
- draftId: note.id,
- note: noteText,
- resolveDiscussion,
- position: JSON.stringify(position),
- })
+) => {
+ const params = {
+ draftId: note.id,
+ note: noteText,
+ resolveDiscussion,
+ };
+ // Stringifying an empty object yields `{}` which breaks graphql queries
+ // https://gitlab.com/gitlab-org/gitlab/-/issues/298827
+ if (!isEmpty(position)) params.position = JSON.stringify(position);
+
+ return service
+ .update(getters.getNotesData.draftsPath, params)
.then((res) => res.data)
.then((data) => commit(types.RECEIVE_DRAFT_UPDATE_SUCCESS, data))
.then(callback)
.catch(() => flash(__('An error occurred while updating the comment')));
+};
export const scrollToDraft = ({ dispatch, rootGetters }, draft) => {
const discussion = draft.discussion_id && rootGetters.getDiscussion(draft.discussion_id);