DEV: App event when modal is closed (#13722)

DEV: App event when modal is closed (#13722)

diff --git a/app/assets/javascripts/discourse/app/routes/application.js b/app/assets/javascripts/discourse/app/routes/application.js
index 0f69756..4f9558c 100644
--- a/app/assets/javascripts/discourse/app/routes/application.js
+++ b/app/assets/javascripts/discourse/app/routes/application.js
@@ -170,11 +170,19 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
         const controller = getOwner(this).lookup(
           `controller:${controllerName}`
         );
-        if (controller && controller.onClose) {
-          controller.onClose({
-            initiatedByCloseButton: initiatedBy === "initiatedByCloseButton",
-            initiatedByClickOut: initiatedBy === "initiatedByClickOut",
+
+        if (controller) {
+          this.appEvents.trigger("modal:closed", {
+            name: controllerName,
+            controller: controller,
           });
+
+          if (controller.onClose) {
+            controller.onClose({
+              initiatedByCloseButton: initiatedBy === "initiatedByCloseButton",
+              initiatedByClickOut: initiatedBy === "initiatedByClickOut",
+            });
+          }
         }
         modalController.set("name", null);
       }

GitHub sha: 5ea98b4df39cab2c29081de2746e994ca11b5948

This commit appears in #13722 which was approved by eviltrout. It was merged by markvanlan.