| 139 | === Conditional Notifications === |
| 140 | |
| 141 | In addition to the required configuration fields described above, you can |
| 142 | optionally include a `.condition` definition for a notification. If provided, |
| 143 | this should be a Genshi text template which evaluates to the value True if and |
| 144 | only if the notification should be sent. If the template evaluates to any value |
| 145 | other than True, the notification will be skipped. |
| 146 | |
| 147 | If no `.condition` is provided, then the notification will be sent unconditionally |
| 148 | when it is triggered. |
| 149 | |
| 150 | One use for this would be sending a notification when a ticket is resolved 'fixed': |
| 151 | |
| 152 | {{{ |
| 153 | [ticket-workflow-notifications] |
| 154 | when_fixed = resolve |
| 155 | when_fixed.body = Ticket $ticket.id has been fixed! View it here: $link |
| 156 | when_fixed.subject = Ticket $ticket.id is fixed! |
| 157 | when_fixed.recipients = $ticket.cc |
| 158 | when_fixed.condition = ${ticket.resolution == 'fixed'} |
| 159 | }}} |
| 160 | |
| 161 | But you could get as complex as you want with this feature: |
| 162 | |
| 163 | {{{ |
| 164 | magic_word.condition = ${'notifyme' in change.comment and change.author != ticket.reporter} |
| 165 | }}} |
| 166 | |