From f38730aab88ead84c7c0df924f5923e0935ef91d Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 21 Jun 2016 09:19:59 -0700 Subject: [PATCH] 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 `, saw expected results in web UI. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D16158 --- src/applications/herald/field/HeraldField.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/applications/herald/field/HeraldField.php b/src/applications/herald/field/HeraldField.php index 98d6d8ffc4..2abed0ff1d 100644 --- a/src/applications/herald/field/HeraldField.php +++ b/src/applications/herald/field/HeraldField.php @@ -80,6 +80,8 @@ abstract class HeraldField extends Phobject { HeraldAdapter::CONDITION_NOT_CONTAINS, HeraldAdapter::CONDITION_REGEXP, HeraldAdapter::CONDITION_NOT_REGEXP, + HeraldAdapter::CONDITION_EXISTS, + HeraldAdapter::CONDITION_NOT_EXISTS, ); case self::STANDARD_TEXT_MAP: return array( @@ -107,7 +109,13 @@ abstract class HeraldField extends Phobject { case self::STANDARD_TEXT: case self::STANDARD_TEXT_LIST: case self::STANDARD_TEXT_MAP: - return new HeraldTextFieldValue(); + switch ($condition) { + case HeraldAdapter::CONDITION_EXISTS: + case HeraldAdapter::CONDITION_NOT_EXISTS: + return new HeraldEmptyFieldValue(); + default: + return new HeraldTextFieldValue(); + } case self::STANDARD_PHID: case self::STANDARD_PHID_NULLABLE: case self::STANDARD_PHID_LIST: