From 5c9acfec1df46db0e571042600f2cb59c6129b21 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 7 Oct 2019 14:29:43 -0400 Subject: [PATCH] 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. --- app/assets/javascripts/discourse/controllers/topic.js.es6 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index 6cb4ecf0bee..010b60707dc 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; }