diff options
Diffstat (limited to 'app/assets/javascripts/batch_comments')
7 files changed, 37 insertions, 31 deletions
diff --git a/app/assets/javascripts/batch_comments/components/draft_note.vue b/app/assets/javascripts/batch_comments/components/draft_note.vue index 74069b61f07..e6de724512f 100644 --- a/app/assets/javascripts/batch_comments/components/draft_note.vue +++ b/app/assets/javascripts/batch_comments/components/draft_note.vue @@ -1,10 +1,9 @@ <script> /* eslint-disable vue/no-v-html */ -import { mapActions, mapGetters, mapState } from 'vuex'; import { GlButton } from '@gitlab/ui'; +import { mapActions, mapGetters, mapState } from 'vuex'; import NoteableNote from '~/notes/components/noteable_note.vue'; import PublishButton from './publish_button.vue'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; export default { components: { @@ -12,7 +11,6 @@ export default { PublishButton, GlButton, }, - mixins: [glFeatureFlagsMixin()], props: { draft: { type: Object, @@ -63,14 +61,14 @@ export default { this.isEditingDraft = false; }, handleMouseEnter(draft) { - if (this.glFeatures.multilineComments && draft.position) { + if (draft.position) { this.setSelectedCommentPositionHover(draft.position.line_range); } }, handleMouseLeave(draft) { - // Even though position isn't used here we still don't want to unecessarily call a mutation + // Even though position isn't used here we still don't want to unnecessarily call a mutation // The lack of position tells us that highlighting is irrelevant in this context - if (this.glFeatures.multilineComments && draft.position) { + if (draft.position) { this.setSelectedCommentPositionHover(); } }, @@ -79,7 +77,6 @@ export default { </script> <template> <article - role="article" class="draft-note-component note-wrapper" @mouseenter="handleMouseEnter(draft)" @mouseleave="handleMouseLeave(draft)" diff --git a/app/assets/javascripts/batch_comments/components/drafts_count.vue b/app/assets/javascripts/batch_comments/components/drafts_count.vue index 7a8482ac341..5e110b101eb 100644 --- a/app/assets/javascripts/batch_comments/components/drafts_count.vue +++ b/app/assets/javascripts/batch_comments/components/drafts_count.vue @@ -1,6 +1,6 @@ <script> -import { mapGetters } from 'vuex'; import { GlBadge } from '@gitlab/ui'; +import { mapGetters } from 'vuex'; export default { components: { diff --git a/app/assets/javascripts/batch_comments/components/preview_dropdown.vue b/app/assets/javascripts/batch_comments/components/preview_dropdown.vue index e18dc344cd7..fb643d441ec 100644 --- a/app/assets/javascripts/batch_comments/components/preview_dropdown.vue +++ b/app/assets/javascripts/batch_comments/components/preview_dropdown.vue @@ -1,6 +1,6 @@ <script> -import { mapActions, mapGetters } from 'vuex'; import { GlDropdown, GlDropdownItem, GlIcon } from '@gitlab/ui'; +import { mapActions, mapGetters } from 'vuex'; import PreviewItem from './preview_item.vue'; export default { diff --git a/app/assets/javascripts/batch_comments/components/preview_item.vue b/app/assets/javascripts/batch_comments/components/preview_item.vue index 3e93168f0e2..756bcfdb3d0 100644 --- a/app/assets/javascripts/batch_comments/components/preview_item.vue +++ b/app/assets/javascripts/batch_comments/components/preview_item.vue @@ -1,22 +1,21 @@ <script> -import { mapGetters } from 'vuex'; import { GlSprintf, GlIcon } from '@gitlab/ui'; +import { mapGetters } from 'vuex'; import { IMAGE_DIFF_POSITION_TYPE } from '~/diffs/constants'; import { sprintf, __ } from '~/locale'; -import resolvedStatusMixin from '../mixins/resolved_status'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { getStartLineNumber, getEndLineNumber, getLineClasses, } from '~/notes/components/multiline_comment_utils'; +import resolvedStatusMixin from '../mixins/resolved_status'; export default { components: { GlIcon, GlSprintf, }, - mixins: [resolvedStatusMixin, glFeatureFlagsMixin()], + mixins: [resolvedStatusMixin], props: { draft: { type: Object, @@ -71,6 +70,10 @@ export default { return this.draft.position || this.discussion.position; }, startLineNumber() { + if (this.position?.position_type === IMAGE_DIFF_POSITION_TYPE) { + // eslint-disable-next-line @gitlab/require-i18n-strings + return `${this.position.x}x ${this.position.y}y`; + } return getStartLineNumber(this.position?.line_range); }, endLineNumber() { @@ -90,16 +93,12 @@ export default { <span> <span class="review-preview-item-header"> <gl-icon class="flex-shrink-0" :name="iconName" /> - <span - class="bold text-nowrap" - :class="{ 'gl-align-items-center': glFeatures.multilineComments }" - > + <span class="bold text-nowrap gl-align-items-center"> <span class="review-preview-item-header-text block-truncated"> {{ titleText }} </span> <template v-if="showLinePosition"> - <template v-if="!glFeatures.multilineComments">:{{ linePosition }}</template> - <template v-else-if="startLineNumber === endLineNumber"> + <template v-if="startLineNumber === endLineNumber"> :<span :class="getLineClasses(startLineNumber)">{{ startLineNumber }}</span> </template> <gl-sprintf v-else :message="__(':%{startLine} to %{endLine}')"> diff --git a/app/assets/javascripts/batch_comments/components/publish_button.vue b/app/assets/javascripts/batch_comments/components/publish_button.vue index ecced36771e..8568dba5947 100644 --- a/app/assets/javascripts/batch_comments/components/publish_button.vue +++ b/app/assets/javascripts/batch_comments/components/publish_button.vue @@ -1,6 +1,6 @@ <script> -import { mapActions, mapState } from 'vuex'; import { GlButton } from '@gitlab/ui'; +import { mapActions, mapState } from 'vuex'; import DraftsCount from './drafts_count.vue'; export default { 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 a29409c52ae..36fef06eeff 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,9 +1,9 @@ import { deprecatedCreateFlash as flash } from '~/flash'; -import { __ } from '~/locale'; import { scrollToElement } from '~/lib/utils/common_utils'; +import { __ } from '~/locale'; +import { CHANGES_TAB, DISCUSSION_TAB, SHOW_TAB } from '../../../constants'; import service from '../../../services/drafts_service'; import * as types from './mutation_types'; -import { CHANGES_TAB, DISCUSSION_TAB, SHOW_TAB } from '../../../constants'; export const saveDraft = ({ dispatch }, draft) => dispatch('saveNote', { ...draft, isDraft: true }, { root: true }); @@ -67,13 +67,23 @@ export const publishReview = ({ commit, dispatch, getters }) => { .catch(() => commit(types.RECEIVE_PUBLISH_REVIEW_ERROR)); }; -export const updateDiscussionsAfterPublish = ({ dispatch, getters, rootGetters }) => - dispatch('fetchDiscussions', { path: getters.getNotesData.discussionsPath }, { root: true }).then( - () => - dispatch('diffs/assignDiscussionsToDiff', rootGetters.discussionsStructuredByLineCode, { - root: true, - }), - ); +export const updateDiscussionsAfterPublish = async ({ dispatch, getters, rootGetters }) => { + if (window.gon?.features?.paginatedNotes) { + await dispatch('stopPolling', null, { root: true }); + await dispatch('fetchData', null, { root: true }); + await dispatch('restartPolling', null, { root: true }); + } else { + await dispatch( + 'fetchDiscussions', + { path: getters.getNotesData.discussionsPath }, + { root: true }, + ); + } + + dispatch('diffs/assignDiscussionsToDiff', rootGetters.discussionsStructuredByLineCode, { + root: true, + }); +}; export const updateDraft = ( { commit, getters }, diff --git a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/index.js b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/index.js index 81dab0566c1..81a51b5ab31 100644 --- a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/index.js +++ b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/index.js @@ -1,7 +1,7 @@ -import state from './state'; -import mutations from './mutations'; import * as actions from './actions'; import * as getters from './getters'; +import mutations from './mutations'; +import state from './state'; export default () => ({ namespaced: true, |