I want to adjust the E-Mail subject to include a word based on status change:
ticket_subject_template = $prefix <word> #$ticket.id: $summary
If the status did not change (status == old status) it should be the word "updated".
If the status did change it should either be the new status or, in case the new status is 'closed', the resolution.
Bonus points if it says "commented" if the only change was a new comment.
Unfortunately the previous ticket value are not available in the notification system. When a ticket is created, ticket.insert
is called. When a ticket is updated, ticket.save_changes
is called. Both of those function reset ticket._old
:
TicketNotifyEmail
is called after ticket.insert
and ticket.save_changes
:
I think we can consider this a defect and a fix should be made in Trac. Would you mind opening a new ticket?
Once the issue is fixed, the following should work:
ticket_subject_template = $prefix ${ticket.status if 'status' in ticket._old and ticket.status != ticket._old.status else (ticket.resolution if ticket.status == 'closed' else 'updated')} #$ticket.id: $summary