From 72a7c19313e2b9ec18e29ead0784444dd2ff3e67 Mon Sep 17 00:00:00 2001 From: Afrisal Yodi Purnama Date: Tue, 23 Oct 2018 06:21:21 +0700 Subject: [PATCH] Confirm delete dialog. --- bitbucket-comment-viewer-app/index.html | 16 +++++++++------- src/commands/addLineComments.ts | 13 +++---------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/bitbucket-comment-viewer-app/index.html b/bitbucket-comment-viewer-app/index.html index 0e25d524d2205..c7e33b467810d 100644 --- a/bitbucket-comment-viewer-app/index.html +++ b/bitbucket-comment-viewer-app/index.html @@ -55,13 +55,15 @@ } function del(data) { - ipcRenderer.send('delete.comment', { - Id: data.getAttribute('commentId'), - Line: data.getAttribute('line'), - Path: data.getAttribute('path'), - Message: data.getAttribute('message'), - Commit: JSON.parse(decodeURIComponent(data.getAttribute('commit'))) - }); + if (window.confirm('Are you sure to delete this comment?')) { + ipcRenderer.send('delete.comment', { + Id: data.getAttribute('commentId'), + Line: data.getAttribute('line'), + Path: data.getAttribute('path'), + Message: data.getAttribute('message'), + Commit: JSON.parse(decodeURIComponent(data.getAttribute('commit'))) + }); + } } var showdown = require('showdown'), diff --git a/src/commands/addLineComments.ts b/src/commands/addLineComments.ts index 0dd9902ba3163..0a62b445ecfaa 100644 --- a/src/commands/addLineComments.ts +++ b/src/commands/addLineComments.ts @@ -268,17 +268,10 @@ export class AddLineCommentCommand extends ActiveEditorCachedCommand { commentAppHelper.getComment(); } if (args.type === operationTypes.Delete) { - // delete comment. - const pick = await window.showQuickPick(['Yes', 'No'], { - placeHolder: 'Are you sure you want to delete this comment (Yes/No)?', - ignoreFocusOut: true + Container.commentService.deleteComment(args.commit!, args.id) + .then(() => { + Container.commentsDecorator.fetchComments(); }); - if (pick! === 'Yes') { - Container.commentService.deleteComment(args.commit!, args.id) - .then(() => { - Container.commentsDecorator.fetchComments(); - }); - } } } else {