Edgewall Software

Opened 7 years ago

Last modified 2 years ago

#12205 closed defect

ticket._old not available in ticket_subject_template — at Version 4

Reported by: Tim Pohlmann Owned by: Ryan J Ollos
Priority: normal Milestone: 1.3.1
Component: notification Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Ticket changes can be used to format the subject template. changes is the dictionary returned from Ticket.get_change.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

The previous ticket values 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.

(see SO:32473999)

Change History (4)

comment:1 by Ryan J Ollos, 7 years ago

Description: modified (diff)
Keywords: ticket._old subject_template removed
Milestone: 1.2
Owner: set to Ryan J Ollos
Status: newassigned

comment:2 by Ryan J Ollos, 7 years ago

I'm unsure what the best approach is to fix the issue. Should we just copy the ticket object before calling save_changes and pass the copy to TicketNotifyEmail.notify?

comment:3 by Ryan J Ollos, 7 years ago


The new notification system provides a more elegant way to fix the issue. We can pass to the template the ticket changes contained in the event.changes attribute. An "old" value can then be accessed through, for example: changes.fields['status']['old]. The implementation is much easier following the refactoring of the notification code that has been prepared in #11901. Proposed changes in [970cec69/rjollos.git]. Included are test cases based on the request in SO:32473999. I used the request as an example of a sufficiently complex ticket_subject_template.

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

comment:4 by Ryan J Ollos, 7 years ago

Release Notes: modified (diff)

DONE Update documentation after changes are committed to trunk: wiki:1.3/TracNotification#Customizingthee-mailsubject (DONE in 1.3/TracNotification@2).

Last edited 6 years ago by Ryan J Ollos (previous) (diff)
Note: See TracTickets for help on using tickets.