DEV: Add app event triggered when composer's reply is reloaded.

DEV: Add app event triggered when composer’s reply is reloaded.

From 8837fe47d77a6218cce0644a87fbd7718aa2d6bc Mon Sep 17 00:00:00 2001
From: Dan Ungureanu <dan@ungureanu.me>
Date: Sun, 4 Nov 2018 11:22:22 +0200
Subject: [PATCH] DEV: Add app event triggered when composer's reply is
 reloaded.


diff --git a/app/assets/javascripts/discourse/models/composer.js.es6 b/app/assets/javascripts/discourse/models/composer.js.es6
index 4599362..230cbff 100644
--- a/app/assets/javascripts/discourse/models/composer.js.es6
+++ b/app/assets/javascripts/discourse/models/composer.js.es6
@@ -686,6 +686,8 @@ const Composer = RestModel.extend({
           originalText: post.get("raw"),
           loading: false
         });
+
+        composer.appEvents.trigger("composer:reply-reloaded", composer);
       });
     } else if (opts.action === REPLY && opts.quote) {
       this.setProperties({
@@ -701,6 +703,10 @@ const Composer = RestModel.extend({
       this.set("originalTitle", this.get("title"));
     }
 
+    if (!isEdit(opts.action) || !opts.post) {
+      composer.appEvents.trigger("composer:reply-reloaded", composer);
+    }
+
     return false;
   },

GitHub

1 Like