2020-04-22 04:37:51 -04:00
|
|
|
import Controller, { inject as controller } from "@ember/controller";
|
|
|
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
|
|
import { alias } from "@ember/object/computed";
|
2020-04-30 11:29:33 -04:00
|
|
|
import { action } from "@ember/object";
|
2020-04-22 04:37:51 -04:00
|
|
|
|
|
|
|
export default Controller.extend(ModalFunctionality, {
|
|
|
|
adminUserIndex: controller(),
|
|
|
|
username: alias("model.username"),
|
|
|
|
|
|
|
|
onShow() {
|
|
|
|
this.set("targetUsername", null);
|
|
|
|
},
|
|
|
|
|
|
|
|
@discourseComputed("username", "targetUsername")
|
|
|
|
mergeDisabled(username, targetUsername) {
|
|
|
|
return !targetUsername || username === targetUsername;
|
|
|
|
},
|
|
|
|
|
2020-04-30 11:29:33 -04:00
|
|
|
@action
|
|
|
|
showConfirmation() {
|
|
|
|
this.send("closeModal");
|
|
|
|
this.adminUserIndex.send("showMergeConfirmation", this.targetUsername);
|
|
|
|
},
|
2020-04-22 04:37:51 -04:00
|
|
|
|
2020-04-30 11:29:33 -04:00
|
|
|
@action
|
|
|
|
close() {
|
|
|
|
this.send("closeModal");
|
2020-04-22 04:37:51 -04:00
|
|
|
},
|
|
|
|
});
|