DEV: Update admin modal controllers to native class syntax (#20685)

This commit was generated using the ember-native-class-codemod along with a handful of manual updates
This commit is contained in:
David Taylor
2023-03-15 17:39:33 +00:00
committed by GitHub
parent 62bbdd25ab
commit c190994046
19 changed files with 483 additions and 423 deletions

View File

@ -1,18 +1,21 @@
import { alias } from "@ember/object/computed";
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"),
export default class AdminMergeUsersConfirmationController extends Controller.extend(
ModalFunctionality
) {
@controller adminUserIndex;
@alias("model.username") username;
@alias("model.targetUsername") targetUsername;
onShow() {
this.set("value", null);
},
}
@discourseComputed("username", "targetUsername")
text(username, targetUsername) {
@ -20,28 +23,28 @@ export default Controller.extend(ModalFunctionality, {
username,
targetUsername,
});
},
}
@discourseComputed("username")
mergeButtonText(username) {
return I18n.t(`admin.user.merge.confirmation.transfer_and_delete`, {
username,
});
},
}
@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");
},
});
}
}