HI!
I see that Discourse’s API script plug-in can get the current user:
<script type="text/discourse-plugin" version="0.8.18">
if(api.getCurrentUser() != null) {
$("#logged-in-user").text(" " + api.getCurrentUser().username);
}
</script>
Is there a similar command to get the current topic? My use case is to change the URL of the redirect button at the end of a post to a pre-filled link to PM the original poster. In order the find the username of the original poster, it seems like I would need to get the topic id first, then query the original poster via "/t/<TOPIC_ID>.json"
?
The button plug-in has <TOPIC_ID>
built in, but I am not sure how that can be done using javascript under Admin > Customization. Thank you!