mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 17:55:11 +08:00
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
import Controller, { inject as controller } from "@ember/controller";
|
|
import I18n from "I18n";
|
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
|
import { action } from "@ember/object";
|
|
import { alias } from "@ember/object/computed";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
|
|
export default Controller.extend(ModalFunctionality, {
|
|
adminUserIndex: controller(),
|
|
username: alias("model.username"),
|
|
targetUsername: alias("model.targetUsername"),
|
|
|
|
onShow() {
|
|
this.set("value", null);
|
|
},
|
|
|
|
@discourseComputed("username", "targetUsername")
|
|
text(username, targetUsername) {
|
|
return I18n.t(`admin.user.merge.confirmation.text`, {
|
|
username,
|
|
targetUsername,
|
|
});
|
|
},
|
|
|
|
@discourseComputed("value", "text")
|
|
mergeDisabled(value, text) {
|
|
return !value || text !== value;
|
|
},
|
|
|
|
@action
|
|
confirm() {
|
|
this.adminUserIndex.send("merge", this.targetUsername);
|
|
this.send("closeModal");
|
|
},
|
|
|
|
@action
|
|
close() {
|
|
this.send("closeModal");
|
|
},
|
|
});
|