mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: improve code readability & add tests for user guardian.
a511bea4cc3f50bd1e067a46bdbf5cd19eb335a3
This commit is contained in:
@ -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");
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user