Opened 9 years ago

Closed 8 years ago

#5599 closed defect (invalid)

Deleting a blocking/blocked by ticket does not fully destroy the relationship

Reported by: emil@… Owned by: Noah Kantrowitz
Priority: highest Component: MasterTicketsPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11


When deleting a relationship in a blocking/blocked by field, the following things should happen:

  1. The blocking/blocked by field of the current ticket should be removed (and change history updated)
  2. The blocked by/blocking field for the referenced ticket should be removed (and change history updated)
  3. The relationship in the mastertickets table should be removed.

Currently, only #1 is happening. The code for this scenario in appears to work fine, the problem is that the ticket_changed function in only adds to the blocking/blocked_by attributes of the link, apparently expecting these sets to be empty. TicketLinks init function, however, populates these attributes with the existing relationships and makes a copy so it can determine the delta on an update. The net effect is that you can never really delete a relationship. To make matter worse, post_process_request is reporting changes based on the text fields, so the user sees relationships "added" and "removed" when in fact only the ticket property changed.

In our local environment, I added the following two lines before the for loops in the ticket_changed function:

links.blocking.clear() links.blocked_by.clear()

The full function now looks like this:

def ticket_changed(self, tkt, comment, author, old_values):

db = self.env.get_db_cnx()

links = TicketLinks(self.env, tkt, db)

links.blocking.clear() links.blocked_by.clear() for s in set(self.NUMBERS_RE.findall(tktblocking? or )):


for s in set(self.NUMBERS_RE.findall(tktblockedby? or )):

links.blocked_by.add(int(s)), comment, tkt.time_changed, db)


Attachments (1)

5599.patch (1.1 KB) - added by isalgueiro@… 9 years ago.
patch that solves this bug

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by isalgueiro@…

Attachment: 5599.patch added

patch that solves this bug

comment:1 Changed 8 years ago by Noah Kantrowitz

Resolution: invalid
Status: newclosed

This bug is only due to incorrect code in another patch you applied. As written in trunk this works fine.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Noah Kantrowitz.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.