Add an appEvent for when a post is created

Add an appEvent for when a post is created

List for post:created and you’ll be passed the new post when it is created.

diff --git a/app/assets/javascripts/discourse/models/composer.js.es6 b/app/assets/javascripts/discourse/models/composer.js.es6
index ebe6d5a..e77a7a4 100644
--- a/app/assets/javascripts/discourse/models/composer.js.es6
+++ b/app/assets/javascripts/discourse/models/composer.js.es6
@@ -941,6 +941,7 @@ const Composer = RestModel.extend({
 
         composer.clearState();
         composer.set("createdPost", createdPost);
+        this.appEvents.trigger("post:created", createdPost);
 
         if (addedToStream) {
           composer.set("composeState", CLOSED);

GitHub sha: 50fae909

1 Like