Changes between Version 3 and Version 4 of WorkflowNotificationPlugin


Ignore:
Timestamp:
Dec 10, 2012, 2:49:22 PM (23 months ago)
Author:
ejucovy
Comment:

update usage examples to show new features in 0.2 -- accessing old ticket values, and '*' no longer includes @created

Legend:

Unmodified
Added
Removed
Modified
  • WorkflowNotificationPlugin

    v3 v4  
    8484[ticket-workflow-notifications]
    8585notify_reporter_when_accepted = accept
    86 notify_reporter_when_accepted.body = Hi $ticket.reporter, '$ticket.summary' has been accepted by $change.author. Its status is now $ticket.status.\n\n{% if change.comment %}$change.author said:\n\n$change.comment{% end %}-----\nTicket URL: $link\n$project.name <${project.url or abs_href()}>\n$project.descr
     86notify_reporter_when_accepted.body = Hi $ticket.reporter, '$ticket.summary' has been accepted
     87                                                             by $change.author. Its status is now $ticket.status.
     88                                                             
     89                                                             {% if change.comment %}$change.author said:
     90                                                             $change.comment{% end %}
     91                                                             -----
     92                                                             Ticket URL: $link
     93                                                             $project.name <${project.url or abs_href()}>
     94                                                             $project.descr
    8795notify_reporter_when_accepted.recipients = $ticket.reporter, trac-admin@hostname.com, trac_user
    8896notify_reporter_when_accepted.subject = '$ticket.summary' is now accepted
     
    149157
    150158You can also set the special value `*` for a notification, which means
    151 it will be triggered on every workflow action including ticket creation:
     159it will be triggered on every workflow action.  However it will not be
     160triggered by ticket creation:
    152161
    153162{{{
     
    159168}}}
    160169
    161 ==== Notifications for the when no action has occurred ====
     170To trigger a notification for every workflow action as well as ticket
     171creation, just specify both:
     172{{{
     173[ticket-workflow-notifications]
     174ticket_changed = *, @created
     175}}}
     176
     177==== Notifications when no action has occurred ====
    162178
    163179A workflow action always occurs when a ticket is changed, even if the user
     
    172188}}}
    173189
     190==== Accessing old ticket values =====
     191
     192The ticket's old values are available in the notification templates.
     193These values are provided in a Python dict named `old_values`.  The
     194values provided are from before any changes were made to the ticket,
     195whether by workflow operations or by direct user action.
     196
     197You can use this dictionary to set up a notification similar to Trac's
     198built in ticket change email; for example:
     199{{{
     200[ticket-workflow-notifications]
     201ticket_changed = *
     202ticket_changed.body = Ticket changed by $change.author: $change.comment
     203                      {% for field in old_ticket %}{% if old_ticket[field] != ticket[field] %}
     204                      $field changed: ${old_ticket[field]} => ${ticket[field]}{% end %}{% end %}
     205ticket_changed.recipients = $ticket.reporter
     206ticket_changed.subject = Ticket $ticket.id has changed!
     207}}}
    174208
    175209== Recent Changes ==