diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /app/assets/javascripts/deprecated_notes.js | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) | |
download | gitlab-ce-41fe97390ceddf945f3d967b8fdb3de4c66b7dea.tar.gz |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'app/assets/javascripts/deprecated_notes.js')
-rw-r--r-- | app/assets/javascripts/deprecated_notes.js | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/app/assets/javascripts/deprecated_notes.js b/app/assets/javascripts/deprecated_notes.js index 82bbbe891e2..0707ae02872 100644 --- a/app/assets/javascripts/deprecated_notes.js +++ b/app/assets/javascripts/deprecated_notes.js @@ -1,6 +1,6 @@ /* eslint-disable no-restricted-properties, babel/camelcase, no-unused-expressions, default-case, -consistent-return, no-alert, no-param-reassign, +consistent-return, no-param-reassign, no-shadow, no-useless-escape, class-methods-use-this */ @@ -17,9 +17,11 @@ import { escape, uniqueId } from 'lodash'; import Vue from 'vue'; import '~/lib/utils/jquery_at_who'; import AjaxCache from '~/lib/utils/ajax_cache'; +import { loadingIconForLegacyJS } from '~/loading_icon_for_legacy_js'; import syntaxHighlight from '~/syntax_highlight'; import CommentTypeDropdown from '~/notes/components/comment_type_dropdown.vue'; import * as constants from '~/notes/constants'; +import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; import Autosave from './autosave'; import loadAwardsHandler from './awards_handler'; import createFlash from './flash'; @@ -243,7 +245,7 @@ export default class Notes { }); } - keydownNoteText(e) { + async keydownNoteText(e) { let discussionNoteForm; let editNote; let myLastNote; @@ -276,9 +278,11 @@ export default class Notes { discussionNoteForm = $textarea.closest('.js-discussion-note-form'); if (discussionNoteForm.length) { if ($textarea.val() !== '') { - if (!window.confirm(__('Your comment will be discarded.'))) { - return; - } + const confirmed = await confirmAction(__('Your comment will be discarded.'), { + primaryBtnVariant: 'danger', + primaryBtnText: __('Discard'), + }); + if (!confirmed) return; } this.removeDiscussionNoteForm(discussionNoteForm); return; @@ -288,9 +292,14 @@ export default class Notes { originalText = $textarea.closest('form').data('originalNote'); newText = $textarea.val(); if (originalText !== newText) { - if (!window.confirm(__('Are you sure you want to discard this comment?'))) { - return; - } + const confirmed = await confirmAction( + __('Are you sure you want to discard this comment?'), + { + primaryBtnVariant: 'danger', + primaryBtnText: __('Discard'), + }, + ); + if (!confirmed) return; } return this.removeNoteEditForm(editNote); } @@ -1753,9 +1762,11 @@ export default class Notes { // Show updated comment content temporarily $noteBodyText.html(formContent); $editingNote.removeClass('is-editing fade-in-full').addClass('being-posted fade-in-half'); - $editingNote - .find('.note-headline-meta a') - .html('<span class="spinner align-text-bottom"></span>'); + + const $timeAgo = $editingNote.find('.note-headline-meta a'); + + $timeAgo.empty(); + $timeAgo.append(loadingIconForLegacyJS({ inline: true, size: 'sm' })); // Make request to update comment on server axios |