1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00

Allow Herald text list fields to use "Exists" / "Does not exist" conditions

Summary: This makes it more natural to write Herald rules about commits that appear on any or no branches.

Test Plan: Wrote a commit rule for commits on any branch, ran it with `bin/repository reparse --herald <commit>`, saw expected results in web UI.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D16158
This commit is contained in:
epriestley 2016-06-21 09:19:59 -07:00
parent ee77c5c8f1
commit f38730aab8

View file

@ -80,6 +80,8 @@ abstract class HeraldField extends Phobject {
HeraldAdapter::CONDITION_NOT_CONTAINS, HeraldAdapter::CONDITION_NOT_CONTAINS,
HeraldAdapter::CONDITION_REGEXP, HeraldAdapter::CONDITION_REGEXP,
HeraldAdapter::CONDITION_NOT_REGEXP, HeraldAdapter::CONDITION_NOT_REGEXP,
HeraldAdapter::CONDITION_EXISTS,
HeraldAdapter::CONDITION_NOT_EXISTS,
); );
case self::STANDARD_TEXT_MAP: case self::STANDARD_TEXT_MAP:
return array( return array(
@ -107,7 +109,13 @@ abstract class HeraldField extends Phobject {
case self::STANDARD_TEXT: case self::STANDARD_TEXT:
case self::STANDARD_TEXT_LIST: case self::STANDARD_TEXT_LIST:
case self::STANDARD_TEXT_MAP: case self::STANDARD_TEXT_MAP:
switch ($condition) {
case HeraldAdapter::CONDITION_EXISTS:
case HeraldAdapter::CONDITION_NOT_EXISTS:
return new HeraldEmptyFieldValue();
default:
return new HeraldTextFieldValue(); return new HeraldTextFieldValue();
}
case self::STANDARD_PHID: case self::STANDARD_PHID:
case self::STANDARD_PHID_NULLABLE: case self::STANDARD_PHID_NULLABLE:
case self::STANDARD_PHID_LIST: case self::STANDARD_PHID_LIST: