MayamaTakeshi / redmine_rt

Redmine plugin for Real-Time notification of events
GNU General Public License v3.0
24 stars 4 forks source link

Related issues field is not updated #54

Closed sk-ys closed 9 months ago

sk-ys commented 9 months ago

Related issues field (#relations) is not updated when others update it. I think a patch needs to be added to the create and destroy methods of the issue_relation model as well as the issue model.

MayamaTakeshi commented 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.

sk-ys commented 9 months ago

Thanks for the advice. I'll give it a try.

sk-ys commented 9 months ago

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.

MayamaTakeshi commented 9 months ago

OK. I will check the PR next Friday.

MayamaTakeshi commented 9 months ago

Merged. Thanks.