Hi,
I am building a function in my companies Help Centre that would allow them to Follow an individual ticket by clicking a button on the request_page.hbs page. I am a bit of a web developer novice, so please forgive me if I am asking something impossible.
When clicked this button invokes a javascript function that updates the ticket with the current user. This takes 2 API calls - one to get the current user (for their authenticity token and id) and a a second PUT call to update the ticket.
I was hoping to disable the button if the user was already following the ticket or to throw a toast on the page, if the user was already following it. My thinking was if I could access the {{collobarators}} object in my javascript function, I could check if the current user was present, but I can't figure out if this is possible.
I am wondering, does anyone have any suggestions on how this could be achieved without making a third API call to check the collaborates on the ticket, before the update is made.
Thanks for reaching out!
I’d like to understand the use-case a bit better before offering any advice. Generally, the requests that a visible to any given user in the help center are their own requests, in which case there wouldn’t be a need for them to be added as a CC in most scenarios.
Can you go in to a bit more detail what the end goal is here?
Thanks!
Tipene