| 185 | |
| 186 | === Emailing all commenters on a ticket |
| 187 | |
| 188 | You can access a list of all users who have participated on a ticket (leaving |
| 189 | a comment, changing a field value) as well as the actions they took with the |
| 190 | variable `change_history`. This will contain a list of dicts, each with an |
| 191 | "author" key, as well as "field", "oldvalue", "newvalue", and "time", ordered |
| 192 | from oldest to newest. |
| 193 | |
| 194 | This can be used to construct a recipient list for everyone who has left a comment |
| 195 | on a ticket: |
| 196 | |
| 197 | {{{#!ini |
| 198 | [ticket-workflow-notifications] |
| 199 | ticket_changed = * |
| 200 | ticket_changed.recipients = ${','.join(list(set(i['author'] for i in change_history if i['author'] != 'anonymous' and i['field'] == 'comment' and i['newvalue'])))} |
| 201 | }}} |
| 202 | |
| 203 | Or you can email everyone who has ever participated on the ticket at all: |
| 204 | {{{#!ini |
| 205 | [ticket-workflow-notifications] |
| 206 | ticket_changed = * |
| 207 | ticket_changed.recipients = ${','.join(list(set(i['author'] for i in change_history if i['author'] != 'anonymous')))} |
| 208 | }}} |
| 209 | |
| 210 | Or you can email everyone who has ever updated a particular field on the ticket: |
| 211 | |
| 212 | {{{#!ini |
| 213 | [ticket-workflow-notifications] |
| 214 | ticket_changed = * |
| 215 | ticket_changed.recipients = ${','.join(list(set(i['author'] for i in change_history if i['author'] != 'anonymous' and i['field'] == 'milestone')))} |
| 216 | }}} |
| 217 | |
| 218 | This can also be used in the email subject, body, and condition templates. |
| 219 | |