Closed sk-ys closed 9 months ago
For now I have just patched the issue_relation model so that issue_relation creation/deletion will be notified. These events will show up in the webconsole like this:
got msg
{
"event": "issue_relation 11 saved",
"type": "issue_relation_saved",
"id": 11,
"issue_from_id": 1,
"issue_to_id": 3
}
got msg
{
"event": "issue_relation 11 deleted",
"type": "issue_relation_deleted",
"id": 11,
"issue_from_id": 1,
"issue_to_id": 3
}
For deletion it would be easy to just find and remove the element from the DOM. However, for addition, I think there is no way to fetch the HTML partial for the element unless doing something similar to what I did for journals_controller which was a hack copying code from redmine views and so subject to inconsistency or bugs if the original code changes. So what I think would be better would be to monitor for the issue_relation events, then fetch the full issue page html doc, extract the #relations element and replace the existing one with it. But I have not much time to work on this right now. PRs are welcome.
Thanks for the advice. I'll give it a try.
I created PR #57. However, I am not sure if this is the best approach. When deleting, I thought a fetch process is necessary because the relation stats need to be updated at the same time.
OK. I will check the PR next Friday.
Merged. Thanks.
Related issues field (
#relations
) is not updated when others update it. I think a patch needs to be added to thecreate
anddestroy
methods of theissue_relation
model as well as theissue
model.