DEV: Replace bootbox confirm dialog (#142)

This commit is contained in:
Jan Cernik 2022-10-27 10:16:00 -03:00 committed by GitHub
parent 5047583d95
commit 7b8a1a3960
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 17 deletions

View File

@ -1,26 +1,23 @@
import Component from "@ember/component";
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "I18n";
import bootbox from "bootbox";
import { inject as service } from "@ember/service";
export default Component.extend({
dialog: service(),
classNames: ["channel-details"],
actions: {
deleteChannel(channel) {
bootbox.confirm(
I18n.t("chat_integration.channel_delete_confirm"),
I18n.t("no_value"),
I18n.t("yes_value"),
(result) => {
if (result) {
channel
.destroyRecord()
.then(() => this.refresh())
.catch(popupAjaxError);
}
}
);
this.dialog.deleteConfirm({
message: I18n.t("chat_integration.channel_delete_confirm"),
didConfirm: () => {
return channel
.destroyRecord()
.then(() => this.refresh())
.catch(popupAjaxError);
},
});
},
editRule(rule) {

View File

@ -205,10 +205,10 @@ acceptance("Chat Integration", function (needs) {
);
await click(".channel-header .delete-channel");
assert.ok(exists("div.bootbox"), "modal is displayed");
await click("div.bootbox .btn-primary");
assert.ok(exists("div.dialog-content"), "modal is displayed");
await click("div.dialog-content .btn-danger");
assert.notOk(exists("div.bootbox"), "modal has closed");
assert.notOk(exists("div.dialog-content"), "modal has closed");
});
test("Delete rule works", async function (assert) {