Edgewall Software

Opened 6 years ago

Last modified 6 years ago

#11672 closed defect

Deleting a milestone should delete its attachments — at Version 1

Reported by: Peter Suter Owned by:
Priority: normal Milestone: 0.12.6
Component: roadmap Version: 0.12.5
Severity: normal Keywords: attachment delete milestone
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Peter Suter)

Deleting a milestone does not delete its attachments. (As previously discussed.)

Proposed fix:

  • trac/ticket/model.py

    diff -r 19ce84254a0a trac/ticket/model.py
    a b  
    10111011        with self.env.db_transaction as db:
    10121012            self.env.log.info("Deleting milestone %s", self.name)
    10131013            db("DELETE FROM milestone WHERE name=%s", (self.name,))
     1014            Attachment.delete_all(self.env, self.realm, self.name)
    10141015            # Don't translate ticket comment (comment:40:ticket:5658)
    10151016            self.move_tickets(retarget_to, author, "Milestone deleted")
    10161017            self._old['name'] = None

Reparenting of attachments when a milestone is renamed was previously fixed in #7933 and a unit test was added.

TODO A similar unit test should be added for deleting attachments.

Change History (2)

comment:1 by Peter Suter, 6 years ago

Description: modified (diff)

by Peter Suter, 6 years ago

Note: See TracTickets for help on using tickets.