diff options
Diffstat (limited to 'app/assets/javascripts/notes')
9 files changed, 31 insertions, 28 deletions
diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue index 996c008b881..a9948fed3b6 100644 --- a/app/assets/javascripts/notes/components/comment_form.vue +++ b/app/assets/javascripts/notes/components/comment_form.vue @@ -369,7 +369,7 @@ export default { class="note-textarea js-vue-comment-form js-note-text js-gfm-input js-autosize markdown-area" data-qa-selector="comment_field" data-testid="comment-field" - :data-supports-quick-actions="!glFeatures.tributeAutocomplete" + data-supports-quick-actions="true" :aria-label="$options.i18n.comment" :placeholder="$options.i18n.bodyPlaceholder" @keydown.up="editCurrentUserLastNote()" diff --git a/app/assets/javascripts/notes/components/diff_with_note.vue b/app/assets/javascripts/notes/components/diff_with_note.vue index b2d5910fd3f..b4f7ba5f960 100644 --- a/app/assets/javascripts/notes/components/diff_with_note.vue +++ b/app/assets/javascripts/notes/components/diff_with_note.vue @@ -107,7 +107,7 @@ export default { <td v-if="error" class="js-error-lazy-load-diff diff-loading-error-block"> {{ __('Unable to load the diff') }} <button - class="btn-link btn-link-retry btn-no-padding js-toggle-lazy-diff-retry-button" + class="btn-link btn-link-retry gl-p-0 js-toggle-lazy-diff-retry-button" @click="fetchDiff" > {{ __('Try again') }} diff --git a/app/assets/javascripts/notes/components/note_form.vue b/app/assets/javascripts/notes/components/note_form.vue index d6b65ed0e8b..ee22c118e11 100644 --- a/app/assets/javascripts/notes/components/note_form.vue +++ b/app/assets/javascripts/notes/components/note_form.vue @@ -5,7 +5,6 @@ import { getDraft, updateDraft } from '~/lib/utils/autosave'; import { mergeUrlParams } from '~/lib/utils/url_utility'; import { __ } from '~/locale'; import markdownField from '~/vue_shared/components/markdown/field.vue'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import eventHub from '../event_hub'; import issuableStateMixin from '../mixins/issuable_state'; import resolvable from '../mixins/resolvable'; @@ -20,7 +19,7 @@ export default { GlSprintf, GlLink, }, - mixins: [glFeatureFlagsMixin(), issuableStateMixin, resolvable], + mixins: [issuableStateMixin, resolvable], props: { noteBody: { type: String, @@ -349,7 +348,7 @@ export default { ref="textarea" v-model="updatedNoteBody" :disabled="isSubmitting" - :data-supports-quick-actions="!isEditing && !glFeatures.tributeAutocomplete" + :data-supports-quick-actions="!isEditing" name="note[note]" class="note-textarea js-gfm-input js-note-text js-autosize markdown-area js-vue-issue-note-form" data-qa-selector="reply_field" diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index 8e32c3b3073..ddf72587ba3 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -5,6 +5,7 @@ import DraftNote from '~/batch_comments/components/draft_note.vue'; import createFlash from '~/flash'; import { clearDraft, getDiscussionReplyKey } from '~/lib/utils/autosave'; import { isLoggedIn } from '~/lib/utils/common_utils'; +import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; import { s__, __ } from '~/locale'; import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; @@ -170,12 +171,13 @@ export default { this.expandDiscussion({ discussionId: this.discussion.id }); } }, - cancelReplyForm(shouldConfirm, isDirty) { + async cancelReplyForm(shouldConfirm, isDirty) { if (shouldConfirm && isDirty) { const msg = s__('Notes|Are you sure you want to cancel creating this comment?'); - // eslint-disable-next-line no-alert - if (!window.confirm(msg)) { + const confirmed = await confirmAction(msg); + + if (!confirmed) { return; } } diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue index 3250a4818c7..7bad10616cc 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -3,6 +3,7 @@ import { GlSprintf, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; import $ from 'jquery'; import { escape, isEmpty } from 'lodash'; import { mapGetters, mapActions } from 'vuex'; +import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; import { INLINE_DIFF_LINES_KEY } from '~/diffs/constants'; import createFlash from '~/flash'; import httpStatusCodes from '~/lib/utils/http_status'; @@ -243,14 +244,18 @@ export default { this.setSelectedCommentPositionHover(); this.$emit('handleEdit'); }, - deleteHandler() { + async deleteHandler() { const typeOfComment = this.note.isDraft ? __('pending comment') : __('comment'); - if ( - // eslint-disable-next-line no-alert - window.confirm( - sprintf(__('Are you sure you want to delete this %{typeOfComment}?'), { typeOfComment }), - ) - ) { + + const msg = sprintf(__('Are you sure you want to delete this %{typeOfComment}?'), { + typeOfComment, + }); + const confirmed = await confirmAction(msg, { + primaryBtnVariant: 'danger', + primaryBtnText: __('Delete Comment'), + }); + + if (confirmed) { this.isDeleting = true; this.$emit('handleDeleteNote', this.note); @@ -345,10 +350,11 @@ export default { parent: this.$el, }); }, - formCancelHandler({ shouldConfirm, isDirty }) { + async formCancelHandler({ shouldConfirm, isDirty }) { if (shouldConfirm && isDirty) { - // eslint-disable-next-line no-alert - if (!window.confirm(__('Are you sure you want to cancel editing this comment?'))) return; + const msg = __('Are you sure you want to cancel editing this comment?'); + const confirmed = await confirmAction(msg); + if (!confirmed) return; } this.$refs.noteBody.resetAutoSave(); if (this.oldContent) { diff --git a/app/assets/javascripts/notes/discussion_filters.js b/app/assets/javascripts/notes/discussion_filters.js index 7c9e7703d59..104e9d4183a 100644 --- a/app/assets/javascripts/notes/discussion_filters.js +++ b/app/assets/javascripts/notes/discussion_filters.js @@ -19,7 +19,7 @@ export default (store) => { return new Vue({ el: discussionFilterEl, - name: 'DiscussionFilter', + name: 'DiscussionFilterRoot', components: { DiscussionFilter, }, diff --git a/app/assets/javascripts/notes/index.js b/app/assets/javascripts/notes/index.js index 2ce60976adb..19fa484d659 100644 --- a/app/assets/javascripts/notes/index.js +++ b/app/assets/javascripts/notes/index.js @@ -14,6 +14,7 @@ export default () => { // eslint-disable-next-line no-new new Vue({ el, + name: 'NotesRoot', components: { notesApp, }, diff --git a/app/assets/javascripts/notes/mixins/discussion_navigation.js b/app/assets/javascripts/notes/mixins/discussion_navigation.js index ad529eb99b6..93236b05100 100644 --- a/app/assets/javascripts/notes/mixins/discussion_navigation.js +++ b/app/assets/javascripts/notes/mixins/discussion_navigation.js @@ -3,8 +3,6 @@ import { scrollToElementWithContext, scrollToElement } from '~/lib/utils/common_ import { updateHistory } from '../../lib/utils/url_utility'; import eventHub from '../event_hub'; -const isDiffsVirtualScrollingEnabled = () => window.gon?.features?.diffsVirtualScrolling; - /** * @param {string} selector * @returns {boolean} @@ -15,7 +13,7 @@ function scrollTo(selector, { withoutContext = false } = {}) { if (el) { scrollFunction(el, { - behavior: isDiffsVirtualScrollingEnabled() ? 'auto' : 'smooth', + behavior: 'auto', }); return true; } @@ -31,7 +29,7 @@ function updateUrlWithNoteId(noteId) { replace: true, }; - if (noteId && isDiffsVirtualScrollingEnabled()) { + if (noteId) { // Temporarily mask the ID to avoid the browser default // scrolling taking over which is broken with virtual // scrolling enabled. @@ -115,17 +113,13 @@ function handleDiscussionJump(self, fn, discussionId = self.currentDiscussionId) const isDiffView = window.mrTabs.currentAction === 'diffs'; const targetId = fn(discussionId, isDiffView); const discussion = self.getDiscussion(targetId); - const setHash = !isDiffView && !isDiffsVirtualScrollingEnabled(); const discussionFilePath = discussion?.diff_file?.file_path; - if (isDiffsVirtualScrollingEnabled()) { - window.location.hash = ''; - } + window.location.hash = ''; if (discussionFilePath) { self.scrollToFile({ path: discussionFilePath, - setHash, }); } diff --git a/app/assets/javascripts/notes/sort_discussions.js b/app/assets/javascripts/notes/sort_discussions.js index ecfa3223039..ca8df880fe4 100644 --- a/app/assets/javascripts/notes/sort_discussions.js +++ b/app/assets/javascripts/notes/sort_discussions.js @@ -8,6 +8,7 @@ export default (store) => { return new Vue({ el, + name: 'SortDiscussionRoot', store, render(createElement) { return createElement(SortDiscussion); |