DEV: rewrite _penalize without async (#10935)

DEV: rewrite _penalize without async (#10935)

  • DEV: rewrite _penalize without async

async is not yet supported in object methods due to uglifyjs.

diff --git a/app/assets/javascripts/discourse/app/controllers/flag.js b/app/assets/javascripts/discourse/app/controllers/flag.js
index 9ee9f05..740af8c 100644
--- a/app/assets/javascripts/discourse/app/controllers/flag.js
+++ b/app/assets/javascripts/discourse/app/controllers/flag.js
@@ -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,
+        });
       });
     }
   },

GitHub sha: e9eeea26

This commit appears in #10935 which was approved by eviltrout and jjaffeux. It was merged by featheredtoast.