Project

General

Profile

Actions

Defect #44258

open

Deleting an issue journal (note) shifts #note-N anchors of later journals, breaking existing links

Added by Yasu Saku about 13 hours ago. Updated about 12 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Resolution:
Affected version:

Description

Summary

Deleting an issue journal (note) renumbers subsequent #note-N anchors, causing existing links to point to the wrong journal.

Steps to reproduce

  1. Create an issue and add 2 notes: "First note" and "Second note" (become #1 and #2).
  2. Add a 3rd note whose text contains the magic link #note-2 (i.e. it references the "Second note" above). This becomes #3.
  3. With "Edit issue notes" permission, delete note #1 ("First note").
  4. Reload the issue and check the #note-2 link inside note #3 (now renumbered #2).

Expected result

The #note-2 link inside that note still points to "Second note".

Actual result

After the renumbering, "Second note" is now #1 and the note containing the link is now #2 . The #note-2 link therefore no longer points to "Second note" — it points to the wrong journal (typically the note containing the link itself, or whichever journal now occupies the #2 position).

Cause

Issue#visible_journals_with_index assigns indice dynamically on each request. Since indice is not a stored column (just an attr_accessor), removing a journal row changes the numbering of all later journals on the next render.

Suggested fix

Instead of physically deleting the journal row, clear the notes field while keeping the journal row. This preserves the positions of subsequent journals and would likely require only a minimal change to the existing implementation.


Files

Actions

Also available in: Atom PDF