DEV: rewrite _penalize without async (#10935)

* DEV: rewrite _penalize without async

async is not yet supported in object methods due to uglifyjs.
This commit is contained in:
Jeff Wong 2020-10-15 11:48:13 -07:00 committed by GitHub
parent 5763309953
commit e9eeea26b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -60,15 +60,16 @@ export default Controller.extend(ModalFunctionality, {
this._penalize("showSilenceModal", performAction);
},
async _penalize(adminToolMethod, performAction) {
_penalize(adminToolMethod, performAction) {
if (this.adminTools) {
let createdBy = await User.findByUsername(this.model.username);
let postId = this.model.id;
let postEdit = this.model.cooked;
return this.adminTools[adminToolMethod](createdBy, {
postId,
postEdit,
before: performAction,
return User.findByUsername(this.model.username).then((createdBy) => {
let postId = this.model.id;
let postEdit = this.model.cooked;
return this.adminTools[adminToolMethod](createdBy, {
postId,
postEdit,
before: performAction,
});
});
}
},