Modify

Opened 4 years ago

Closed 4 years ago

#13848 closed defect (fixed)

links of the form 'comment:n:ticket:x are broken if ticket is a master ticket

Reported by: Geert Owned by: Ryan J Ollos
Priority: normal Component: MasterTicketsPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

When I add a link to a master ticket from another ticket, for instance comment:1:ticket:21, and the linked ticket is a master ticket, I get text ticket comment does not exist if I hover above the link. The link is also greyed out instead of red.

This however only happens if the comment I link to is empty or was initially 'empty'.

You get an 'empty' comment, for instance, if you modify the Description of the ticket (then you get a comment Description: modified (diff)) or when you add a child ticket (then you get a comment Blocked By: 77 added).

You can edit these 'empty' comments and add text to them. But it is impossible to link to them.

This doesn't happen if I link to 'empty' comments in normal tickets, e.g. comment:9:ticket:6032 in this database. Unfortunately, there are no master tickets in this database to try.

See attached file for the versions I am using.

Attachments (1)

about (22.3 KB) - added by Geert 4 years ago.

Download all attachments as: .zip

Change History (7)

Changed 4 years ago by Geert

Attachment: about added

comment:1 in reply to:  description Changed 4 years ago by Ryan J Ollos

Replying to Geert:

You get an 'empty' comment, for instance, if you modify the Description of the ticket (then you get a comment Description: modified (diff)) or when you add a child ticket (then you get a comment Blocked By: 77 added). You can edit these 'empty' comments and add text to them. But it is impossible to link to them.

This doesn't happen if I link to 'empty' comments in normal tickets, e.g. comment:9:ticket:6032 in this database. Unfortunately, there are no master tickets in this database to try.

You said you could reproduce the behavior by just editing the comment:description, right?

comment:9:ticket:6032 doesn't seem to be empty, but comment:13:ticket:6032 is.

Do you get the same behavior for empty comments if MasterTicketsPlugin is disabled? I suspect this is a Trac problem, that was fixed since 1.2 (your version). You could upgrade to at least the latest 1.2.x, which is 1.2.6.

comment:2 Changed 4 years ago by Geert

I looked into it in a bit more detail. It seems to be a bit more limited than I initially thought.

The steps for me to reproduce the behaviour are:

  1. the linked-to ticket must be a master ticket
  2. the linked-to comment must have been created as a result of clicking on one of the child ticket buttons

This will create a comment of the form Blocked By: xxx added.

These comments I can't link to, not even if I add some text to the comment at a later stage (using the 'edit' button).

It is not enough to manually edit the Blocked By field: The comment must be created by creating a child ticket.

I was wrong about changing the Description or other fields. It seems to be a problem related to the combination of master tickets (plugin TracMasterTickets 4.0.2) and the child tickets (plugin Tracchildtickets 2.5.6.dev0).

I would like to upgrade trac and the plugins, but we use it in the company I work for. So it is a bit more involved.

comment:3 Changed 4 years ago by Ryan J Ollos

In 17800:

TracMasterTickets 4.0.5dev: Fix incorrect change log entries

The entries in the referenced tickets' ticket_change
table lacked the proper cnum entries.

Refs #13848.

comment:4 Changed 4 years ago by Ryan J Ollos

Hoping r17800 fixes the issue for you, without causing any side effects. This plugin is pretty fragile and needs a major overhaul and unit tests.

comment:5 Changed 4 years ago by Geert

I installed the new revision of the plugin on a sandbox machine and tested it.

It fixes the issue when creating new children in the master ticket. Thanks for that.

Unfortunately, existing 'broken' comments stay broken, but I can live with that (*).

(*) I can fix the 'broken' comments by manually adding the missing entries in the database, e.g.:

sqlite> insert into ticket_change (ticket,time,author,field,oldvalue)
          values (5,1534304016173472,'trac','comment','1');

comment:6 Changed 4 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Yeah, I didn't look super close, but it appears the issue was that cnum was not getting set: browser:tags/trac-1.2/trac/ticket/model.py@:390#L385.

cnum is stored in the oldvalue column (trac:wiki/TracDev/DatabaseSchema/TicketSystem#Tableticket_change).

cnum is either a sequentially incrementing integer, or incorporates hte cnum of the comment that is being replied-to: cnum = '%s.%s' % (replyto, cnum).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.