HomePhabricator

(stable) Fix a Herald repetition policy selection error for rule types which…

Description

(stable) Fix a Herald repetition policy selection error for rule types which support only one policy

Summary:
Ref T13048. See https://discourse.phabricator-community.org/t/configuring-commit-hook-commit-content-rules-fail-with-exception/1077/3.

When a rule supports only one repetition policy (always "every time") like "Commit Hook" rules, we don't render a control for repetition_policy and fail to update it when saving.

Before the changes to support the new "if the rule did not match the last time" policy, this workflow just defaulted to "every time" if the input was invalid, but this was changed by accident in D18926 when I removed some of the toInt/toString juggling code.

(This patch also prevents users from fiddling with the form to create a rule which evaluates with an invalid policy; this wasn't validated before.)

Test Plan:

  • Created new "Commit Hook" (only one policy available) rule.
  • Saved existing "Commit Hook" rule.
  • Created new "Task" (multiple policies) rule.
  • Saved existing Task rule.
  • Set task rule to each repetition policy, saved, verified the save worked.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13048

Differential Revision: https://secure.phabricator.com/D18992