Commit e32b2a24 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'jnnkl-modal-noteable' into 'master'

Replace window.confirm with GlModal for noteable discussions

See merge request gitlab-org/gitlab!78661
parents d3fc18ff 20e05799
......@@ -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;
}
}
......
......@@ -707,9 +707,10 @@ RSpec.describe 'GFM autocomplete', :js do
def start_and_cancel_discussion
fill_in('Reply to comment', with: 'Whoops!')
page.accept_alert 'Are you sure you want to cancel creating this comment?' do
click_button('Cancel')
page.within('.modal') do
click_button('OK', match: :first)
end
wait_for_requests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment