Commits

Anonymous committed aa844ab

0.12.3dev: Make sure ticket changetime is reset correctly when deleting the only change. Fixes #10338.

  • Participants
  • Parent commits 9e7a896
  • Branches 0.12-stable

Comments (0)

Files changed (2)

File trac/ticket/model.py

             cursor.execute("""
                 UPDATE ticket SET changetime=(
                     SELECT time FROM ticket_change WHERE ticket=%s
+                    UNION
+                    SELECT time FROM ticket WHERE id=%s
                     ORDER BY time DESC LIMIT 1)
                 WHERE id=%s
-                """, (self.id, self.id))
+                """, (self.id, self.id, self.id))
 
         self._fetch_ticket(self.id)
 

File trac/ticket/tests/model.py

             keywords=dict(author='joe', old='1, 2', new='a'),
             foo=dict(author='joe', old='change2', new='change4'))
         
+    def test_delete_all_comments(self):
+        # See ticket:10338
+        ticket = Ticket(self.env, self.id)
+        ticket.delete_change(4)
+        ticket.delete_change(3)
+        ticket.delete_change(2)
+        ticket.delete_change(1)
+        self.assertEquals(ticket['time'], ticket['changetime'])
+
 
 class EnumTestCase(unittest.TestCase):