mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:21:43 +08:00
FIX: remove rendering UX from ember models (#11724)
Fix for `admin-user.js` and `backup.js` models.
This commit is contained in:

committed by
GitHub

parent
fb184fed06
commit
8b10fc2f8c
@ -0,0 +1,31 @@
|
||||
import Controller from "@ember/controller";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import I18n from "I18n";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import messageBus from "message-bus-client";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
message: I18n.t("admin.user.merging_user"),
|
||||
|
||||
onShow() {
|
||||
messageBus.subscribe("/merge_user", (data) => {
|
||||
if (data.merged) {
|
||||
if (/^\/admin\/users\/list\//.test(location)) {
|
||||
DiscourseURL.redirectTo(location);
|
||||
} else {
|
||||
DiscourseURL.redirectTo(
|
||||
`/admin/users/${data.user.id}/${data.user.username}`
|
||||
);
|
||||
}
|
||||
} else if (data.message) {
|
||||
this.set("message", data.message);
|
||||
} else if (data.failed) {
|
||||
this.set("message", I18n.t("admin.user.merge_failed"));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onClose() {
|
||||
this.messageBus.unsubscribe("/merge_user");
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user