mirror of
https://github.com/discourse/discourse-chat-integration.git
synced 2025-03-06 17:59:29 +00:00
DEV: Replace bootbox confirm dialog (#142)
This commit is contained in:
parent
5047583d95
commit
7b8a1a3960
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user