A hopefully brief intro (ha): my company has a plugin we've developed for a private client that handles replacements in Jira issues. So, for example:
Issue is assigned to user A.
User A gets sick, so replacement logic will replace User A with User B.
If the issue has not been resolved yet, and User A comes back from their leave of absence, the replacement logic with swap User B back to User A.
This is accomplished through two listeners that listen to events inside issue, like ISSUE_UPDATED, and so on and so forth.
There is also a JobRunner job, that runs every 4 hours, and updates the backend for each absence, and any issue that absence affects.
These changes are reflected, however, only the next time there's an event call happening to any of the affected issues. Although there is a bit of JS code that handles absent user name appearing red, and a tooltip informing that the user is absent, which is immediately reflected by background changes, even if the issue itself hasn't been updated.
WHAT I'M TRYING TO ACHIEVE: I've implemented additional logic, where if User A is absent, then they get put in a custom field called 'Absence', while User A in field 'Assignee' is replaced with User B.
As follows, when User A comes back, custom field 'Absence' gets cleared/disappears, and User A is set back to 'Assignee', if issue status is still unresolved.
WHAT I WANT is for all issues related to the absence to get updated appropriately every time the JobRunner job runs (every 4 hours). So not just the backend/database is updated, but also the 'Absence', 'Assignee' fields.
I know the best solution would be to just rewrite the plugin to use React/Angular. But in this case we don't really have the resources/time, so what I'd like to do is to dispatch an issue event to all the affected issues from a JobRunner class.
I tried a couple of things and I'm honestly kind of out of my depth.