I have an application that creates user notifications when various things happen within the application.
Each notification contains a link that is generated upon creation of the notification that directs the user to the part of the application the notification intends to draw attention.
This link can be to anywhere on the site.
Upon creation, a notification is marked as unread = true, when a user clicks the link I want to take the user to the proper location, but also fire an action that will set the notification to unread = false.
How can I accomplish this? Is there a way I can filter all links on a page to first be redirected to an action that sets the notification to unread = false then takes them to the url? I’m not exactly sure where to start here.
Do an Ajax call in onclick of the link
Edit: another solution (perhaps better)
Or perhaps you do not really need an extra Ajax Call at all. If I understand your question properly, I believe you have an action like:
Just change it to