Add event for when "Reply" is clicked

Add event for when “Reply” is clicked

This is useful by analytics libraries or other code that wants to track when replies are begun. A new event: page:compose-reply is fired with the topic.

diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6
index 6cb4ecf..010b607 100644
--- a/app/assets/javascripts/discourse/controllers/topic.js.es6
+++ b/app/assets/javascripts/discourse/controllers/topic.js.es6
@@ -471,6 +471,8 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
       const quoteState = this.quoteState;
       const postStream = this.get("model.postStream");
 
+      this.appEvents.trigger("page:compose-reply", topic);
+
       if (!postStream || !topic || !topic.get("details.can_create_post")) {
         return;
       }

GitHub sha: 5c9acfec

1 Like