Skip to content

Commit

Permalink
Merge pull request gitkraken#58 from afrisalyp/issue-33
Browse files Browse the repository at this point in the history
Issue 33: Confirm delete dialog. gitkraken#57
  • Loading branch information
billsedison authored Oct 23, 2018
2 parents 457f6e4 + 72a7c19 commit 71db730
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
16 changes: 9 additions & 7 deletions bitbucket-comment-viewer-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
13 changes: 3 additions & 10 deletions src/commands/addLineComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 71db730

Please sign in to comment.