mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 11:41:03 +08:00
DEV: Convert merge-users
modals to component-based API (#22727)
This commit is contained in:
@ -13,6 +13,9 @@ import getURL from "discourse-common/lib/get-url";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
import { extractError, popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import MergeUsersConfirmationModal from "../components/modal/merge-users-confirmation";
|
||||
import MergeUsersPromptModal from "../components/modal/merge-users-prompt";
|
||||
import MergeUsersProgressModal from "../components/modal/merge-users-progress";
|
||||
import DeletePostsConfirmationModal from "../components/modal/delete-posts-confirmation";
|
||||
|
||||
export default class AdminUserIndexController extends Controller.extend(
|
||||
@ -438,19 +441,21 @@ export default class AdminUserIndexController extends Controller.extend(
|
||||
|
||||
@action
|
||||
promptTargetUser() {
|
||||
showModal("admin-merge-users-prompt", {
|
||||
admin: true,
|
||||
model: this.model,
|
||||
this.modal.show(MergeUsersPromptModal, {
|
||||
model: {
|
||||
user: this.model,
|
||||
showMergeConfirmation: this.showMergeConfirmation,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
showMergeConfirmation(targetUsername) {
|
||||
showModal("admin-merge-users-confirmation", {
|
||||
admin: true,
|
||||
this.modal.show(MergeUsersConfirmationModal, {
|
||||
model: {
|
||||
username: this.model.username,
|
||||
targetUsername,
|
||||
merge: this.merge,
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -470,10 +475,7 @@ export default class AdminUserIndexController extends Controller.extend(
|
||||
.merge(formData)
|
||||
.then((response) => {
|
||||
if (response.success) {
|
||||
showModal("admin-merge-users-progress", {
|
||||
admin: true,
|
||||
model: this.model,
|
||||
});
|
||||
this.modal.show(MergeUsersProgressModal);
|
||||
} else {
|
||||
this.dialog.alert(I18n.t("admin.user.merge_failed"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user