On 'reply' click call

Hi all :slight_smile:
I was wondering how can I add a call method when clicking on the ‘reply’ button in some topic? I want to add some message to pop-up if some conditions are true.
Thank you.

I’m also interested in this.

I think api.onAppEvent("page:compose-reply", callback) should work
https://github.com/discourse/discourse/blob/01a9c57dcbea7dae5aaf4f34b82f1f52f060513b/app/assets/javascripts/discourse/app/templates/topic.hbs#L146
https://github.com/discourse/discourse/blob/01a9c57dcbea7dae5aaf4f34b82f1f52f060513b/app/assets/javascripts/discourse/app/controllers/topic.js#L487

3 Likes

Thanks! It works indeed. :+1:
Couldn’ find the event for creating a new topic though.

Find the create-topic-button template and Class you may discove something, also Installing the Inspector - Ember Inspector - Ember Guides can help you resolve something like that.