DEV: update yes/no confirmation dialogs (#18181)

This commit is contained in:
Penar Musaraj
2022-09-14 11:06:56 -04:00
committed by GitHub
parent 04e433d286
commit 86ecb6c58b
30 changed files with 506 additions and 617 deletions

View File

@ -2,13 +2,14 @@ import Controller, { inject as controller } from "@ember/controller";
import { alias, sort } from "@ember/object/computed";
import GrantBadgeController from "discourse/mixins/grant-badge-controller";
import I18n from "I18n";
import bootbox from "bootbox";
import discourseComputed from "discourse-common/utils/decorators";
import { next } from "@ember/runloop";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { inject as service } from "@ember/service";
export default Controller.extend(GrantBadgeController, {
adminUser: controller(),
dialog: service(),
user: alias("adminUser.model"),
userBadges: alias("model"),
allBadges: alias("badges"),
@ -90,18 +91,14 @@ export default Controller.extend(GrantBadgeController, {
},
revokeBadge(userBadge) {
return bootbox.confirm(
I18n.t("admin.badges.revoke_confirm"),
I18n.t("no_value"),
I18n.t("yes_value"),
(result) => {
if (result) {
userBadge.revoke().then(() => {
this.model.removeObject(userBadge);
});
}
}
);
return this.dialog.yesNoConfirm({
message: I18n.t("admin.badges.revoke_confirm"),
didConfirm: () => {
return userBadge.revoke().then(() => {
this.model.removeObject(userBadge);
});
},
});
},
},
});