UX: ask for confirmation when deleting a post using shortcut (#16526)

This commit is contained in:
Andrei Prigorshnev 2022-04-26 01:50:54 +04:00 committed by GitHub
parent c1d9822003
commit 3e0cb8ea47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -702,6 +702,19 @@ export default Controller.extend(bufferedProperty("model"), {
}
},
deletePostWithConfirmation(post, opts) {
bootbox.confirm(
I18n.t("post.confirm_delete"),
I18n.t("no_value"),
I18n.t("yes_value"),
(confirmed) => {
if (confirmed) {
this.send("deletePost", post, opts);
}
}
);
},
permanentlyDeletePost(post) {
return bootbox.confirm(
I18n.t("post.controls.permanently_delete_confirmation"),

View File

@ -49,7 +49,7 @@ const DEFAULT_BINDINGS = {
"command+right": { handler: "webviewKeyboardForward", anonymous: true },
"command+]": { handler: "webviewKeyboardForward", anonymous: true },
"mod+p": { handler: "printTopic", anonymous: true },
d: { postAction: "deletePost" },
d: { postAction: "deletePostWithConfirmation" },
e: { handler: "editPost" },
end: { handler: "goToLastPost", anonymous: true },
"command+down": { handler: "goToLastPost", anonymous: true },

View File

@ -3053,6 +3053,7 @@ en:
deleted_by_author_simple: "(topic deleted by author)"
post:
confirm_delete: "Are you sure you want to delete this post?"
quote_reply: "Quote"
quote_reply_shortcut: "Or press q"
quote_edit: "Edit"