| 112 | == Example: Add simple optional generic review state == |
| 113 | |
| 114 | Sometimes Trac is used in situations where "testing" can mean different things to different people so you may want to create an optional workflow state that is between the default workflow's `assigned` and `closed` states, but does not impose implementation-specific details. The only new state you need to add for this is a `reviewing` state. A ticket may then be "submitted for review" from any state that it can be reassigned. If a review passes, you can re-use the `resolve` action to close the ticket, and if it fails you can re-use the `reassign` action to push it back into the normal workflow. |
| 115 | |
| 116 | The new `reviewing` state along with its associated `review` action looks like this: |
| 117 | |
| 118 | {{{ |
| 119 | review = new,assigned,reopened -> reviewing |
| 120 | review.operations = set_owner |
| 121 | review.permissions = TICKET_MODIFY |
| 122 | }}} |
| 123 | |
| 124 | Then, to integrate this with the default Trac 0.11 workflow, you also need to add the `reviewing` state to the `accept` and `resolve` actions, like so: |
| 125 | |
| 126 | {{{ |
| 127 | accept = new,reviewing -> assigned |
| 128 | […] |
| 129 | resolve = new,assigned,reopened,reviewing -> closed |
| 130 | }}} |
| 131 | |
| 132 | Optionally, you can also add a new action that allows you to change the ticket's owner without moving the ticket out of the `reviewing` state. This enables you to reassign review work without pushing the ticket back to the `new` status. |
| 133 | |
| 134 | {{{ |
| 135 | reassign_reviewing = reviewing -> * |
| 136 | reassign_reviewing.name = reassign review |
| 137 | reassign_reviewing.operations = set_owner |
| 138 | reassign_reviewing.permissions = TICKET_MODIFY |
| 139 | }}} |
| 140 | |
| 141 | The full `[ticket-workflow]` configuration will thus look like this: |
| 142 | |
| 143 | {{{ |
| 144 | [ticket-workflow] |
| 145 | accept = new,reviewing -> assigned |
| 146 | accept.operations = set_owner_to_self |
| 147 | accept.permissions = TICKET_MODIFY |
| 148 | leave = * -> * |
| 149 | leave.default = 1 |
| 150 | leave.operations = leave_status |
| 151 | reassign = new,assigned,reopened -> new |
| 152 | reassign.operations = set_owner |
| 153 | reassign.permissions = TICKET_MODIFY |
| 154 | reopen = closed -> reopened |
| 155 | reopen.operations = del_resolution |
| 156 | reopen.permissions = TICKET_CREATE |
| 157 | resolve = new,assigned,reopened,reviewing -> closed |
| 158 | resolve.operations = set_resolution |
| 159 | resolve.permissions = TICKET_MODIFY |
| 160 | review = new,assigned,reopened -> reviewing |
| 161 | review.operations = set_owner |
| 162 | review.permissions = TICKET_MODIFY |
| 163 | reassign_reviewing = reviewing -> * |
| 164 | reassign_reviewing.operations = set_owner |
| 165 | reassign_reviewing.name = reassign review |
| 166 | reassign_reviewing.permissions = TICKET_MODIFY |
| 167 | }}} |
| 168 | |