Allow numeric constants to act as aliases for task priorities in the web UI…

Authored by epriestley on Jun 19 2017, 7:15 PM.


Allow numeric constants to act as aliases for task priorities in the web UI <select />

Ref T12124. This is a fairly narrow fix for existing saved EditEngine forms with a default priority value.

These saved forms have a numeric (or probably "string-numeric") default value, like "50". They lost their meaning after D18111, when "50" no longer appears in the dropdown. Instead, these forms all select the highest available priority.

At time of writing, this form was broken on this install, for example:


Additionally, /task/edit/form/123/?priority=... (for templating forms) stopped working with priority=50. This isn't nearly as important, but a larger and more sudden compatiblity break than we need to make.

Add support for an "alias map" on <select /> controls, so if the value comes in with something we don't recognize we'll treat it like some other value. Then alias all the numeric constants -- and other keywords -- to the right constants.

This ended up only affecting the <select /> control in the web UI.

Test Plan:

  • On stable, created a form with "Priority: Low".
  • Before patch: form has "Priority: Unbreak Now!" on master.
  • After patch: form has "Priority: Low" again.
  • Used ?priority=25, ?priority=wish, ?priority=wishlist to template forms: all forms worked.

Reviewers: amckinley, chad

Reviewed By: amckinley

Maniphest Tasks: T12124

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