Cross-link only "related to", with permission and ID fixes

- Only cross-links "relates": directional types created invented
  relations, and "precedes" rescheduled dates / "duplicates" closed
  issues between the targets
- Requires permission to manage relations in both issues' projects
  (cross-links are between issues the user isn't editing)
- Parses issue ids the way Redmine does ("#13", spaces), so "#" ids are
  no longer dropped
- Uses the relations actually saved to the base issue instead of the
  form-only @unsaved_relations, so it behaves the same for the form, a
  plain post and the API
- Skips pairs already related, caps at 10 issues per request, and logs
  failures instead of raising after the relations were saved

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-28 23:47:41 -04:00
1 parent 4445823cf4
commit 9460d4bf2e
2 files changed
+73 -34

No files matched your search

+5 -2
View File
@@ -4,8 +4,11 @@
This plugin extends the default issue relation functionality in Redmine. When adding multiple issues as a relation via a comma-separated string (e.g., `12, 13, 15`), Redmine natively links the base issue to each of these targets. This plugin automatically extends this behavior by cross-relating all the newly provided issues with each other.
## Features
- Automatically creates cross-relations for comma-separated issue IDs.
- Gracefully handles validation failures (e.g., missing issues, cross-project restrictions).
- Automatically creates cross-relations for comma-separated issue IDs (`12, #13, 15` all work).
- Only for "Related to": directional types (blocks, precedes, duplicates, copied to) are never cross-linked, since that would invent relations and could reschedule or close issues.
- Only cross-links issues Redmine actually related to the base issue, and only where you're allowed to manage relations in both issues' projects.
- Cross-links at most 10 issues per request (45 relations), to avoid flooding issue history and notifications.
- Gracefully handles validation failures (e.g., missing issues, cross-project restrictions); problems are logged, never shown as an error page.
- Lightweight, using standard Rails `ActiveSupport::Concern` to patch the controller without overriding core files.
---