| 155 | You can also specify a condition under which the validation should be applied: |
| 156 | {{{ |
| 157 | [ticket-custom] |
| 158 | phase.invalid_if.1 = verifying |
| 159 | phase.invalid_when.1 = .codereviewstatus .pending (msg:Pending code reviews.) |
| 160 | phase.invalid_if.2 = verifying |
| 161 | phase.invalid_when.2 = .codereviewstatus:last .rejected (msg:The last code review did not pass.) |
| 162 | }}} |
| 163 | |
| 164 | The above example is for the [wiki:CodeReviewerPlugin CodeReviewer plugin] when using its ticket reference macro to prevent a ticket moving a custom {{{phase}}} field past "codereview" if there are either pending reviews or the last changeset has not passed review. The value is a jQuery selector - if it returns one or more items then the validation is applied, else it's skipped. The {{{.1}}} and {{{.2}}} suffix for the option keys are to group the {{{invalid_if}}} and {{{invalid_when}}} parts together. |