mirror of
https://github.com/discourse/discourse-chat-integration.git
synced 2025-07-06 22:02:14 +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 Component from "@ember/component";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import bootbox from "bootbox";
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
dialog: service(),
|
||||||
classNames: ["channel-details"],
|
classNames: ["channel-details"],
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
deleteChannel(channel) {
|
deleteChannel(channel) {
|
||||||
bootbox.confirm(
|
this.dialog.deleteConfirm({
|
||||||
I18n.t("chat_integration.channel_delete_confirm"),
|
message: I18n.t("chat_integration.channel_delete_confirm"),
|
||||||
I18n.t("no_value"),
|
didConfirm: () => {
|
||||||
I18n.t("yes_value"),
|
return channel
|
||||||
(result) => {
|
.destroyRecord()
|
||||||
if (result) {
|
.then(() => this.refresh())
|
||||||
channel
|
.catch(popupAjaxError);
|
||||||
.destroyRecord()
|
},
|
||||||
.then(() => this.refresh())
|
});
|
||||||
.catch(popupAjaxError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
editRule(rule) {
|
editRule(rule) {
|
||||||
|
@ -205,10 +205,10 @@ acceptance("Chat Integration", function (needs) {
|
|||||||
);
|
);
|
||||||
await click(".channel-header .delete-channel");
|
await click(".channel-header .delete-channel");
|
||||||
|
|
||||||
assert.ok(exists("div.bootbox"), "modal is displayed");
|
assert.ok(exists("div.dialog-content"), "modal is displayed");
|
||||||
await click("div.bootbox .btn-primary");
|
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) {
|
test("Delete rule works", async function (assert) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user