Project

General

Profile

Actions

Defect #44258

closed

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

Added by Yasu Saku 22 days ago. Updated 5 days ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
Resolution:
Fixed
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 #1

Updated by Yasu Saku 22 days ago

I've created a patch for the latest trunk (r24843).

Deleting a note with the patch applied

Actions #2

Updated by Marius BĂLTEANU 21 days ago

  • Status changed from New to Confirmed
Actions #3

Updated by Marius BĂLTEANU 21 days ago

  • Assignee set to Marius BĂLTEANU
  • Target version set to 6.1.4
  • Resolution set to Fixed

I've fixed the issue and added a test to validate the new behaviour. I think we can merge this fix to stable branches.

Actions #4

Updated by Yasu Saku 21 days ago

Thank you for the quick response.

Actions #5

Updated by Marius BĂLTEANU 5 days ago

  • Status changed from Confirmed to Closed
Actions

Also available in: Atom PDF