changetime is not updated when editing comments
|Reported by:||Owned by:||Remy Blank|
We use the XmlRpc API ticket.getRecentChanges to query on changetime > (yesterday) to keep tabs on recently modified tickets. If a new comment is added to a ticket, the changetime is updated correctly and we get the ticket in the list of changed tickets.
However if a comment is edited, the changetime remains the same as before the comment edit. This causes us to miss tickets that have been updated with new (possibly critical) information.
I considered whether editing a comment truly constitutes a modification to the ticket. I figured that if adding a comment justifies updating ticket changetime, then editing a comment should too.
I also looked for a [ticket] option on whether to update changetime on comment edit (similar to the batch mod plugin), but I did not see one.
Here is a sample TracReport which shows tickets modified in the last 24 hours:
SELECT id AS ticket, summary, datetime(changetime/1000000, 'unixepoch') AS LastModified, description AS _description, status FROM ticket t WHERE LastModified >= datetime('now','-24 hours') ORDER BY time DESC
To repro, just modify a ticket in that list, and you can see the changetime does not get updated.
Looking at ticket/model.py, seems like adding something similar to this at the end of modify_comment might do the trick:
when_ts = to_utimestamp(datetime.now(utc)) cursor.execute("UPDATE ticket SET changetime=%s WHERE id=%s", (when_ts, self.id))
While I can patch this myself for my instance, I would be very interested in seeing this get into a release so that others using the XmlRpc API would get the expected result. Thanks in advance for considering this defect.