DEV: improve code readability & add tests for user guardian.

a511bea4cc3f50bd1e067a46bdbf5cd19eb335a3
This commit is contained in:
Vinoth Kannan
2020-04-30 20:59:33 +05:30
parent c092370847
commit 71241a50f7
8 changed files with 62 additions and 30 deletions

View File

@ -2,6 +2,7 @@ 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";
import { action } from "@ember/object";
export default Controller.extend(ModalFunctionality, {
adminUserIndex: controller(),
@ -14,7 +15,10 @@ export default Controller.extend(ModalFunctionality, {
@discourseComputed("username", "targetUsername")
text(username, targetUsername) {
return `transfer @${username} to @${targetUsername}`;
return I18n.t(`admin.user.merge.confirmation.text`, {
username,
targetUsername
});
},
@discourseComputed("value", "text")
@ -22,14 +26,14 @@ export default Controller.extend(ModalFunctionality, {
return !value || text !== value;
},
actions: {
merge() {
this.adminUserIndex.send("merge", this.targetUsername);
this.send("closeModal");
},
@action
confirm() {
this.adminUserIndex.send("merge", this.targetUsername);
this.send("closeModal");
},
cancel() {
this.send("closeModal");
}
@action
close() {
this.send("closeModal");
}
});