From f35ce505a14dd2b3ca9651f648748382fb33a842 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 11 Nov 2013 14:19:12 -0800 Subject: [PATCH] Herald - add ability to conditionalize on Maniphest Task projects Summary: adds FIELD_PROJECTS and deploys it to Maniphest Task Herald Adapter. Went with "projects" because it feels like that could go well in other Adapters that want to conditionalize based on project. Test Plan: made a new herald rule to be cc'd if project foo was on a task. it worked! Reviewers: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7564 --- src/applications/herald/adapter/HeraldAdapter.php | 4 ++++ .../herald/adapter/HeraldManiphestTaskAdapter.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php index 40cd9c8aaa..bd1e2617c4 100644 --- a/src/applications/herald/adapter/HeraldAdapter.php +++ b/src/applications/herald/adapter/HeraldAdapter.php @@ -24,6 +24,7 @@ abstract class HeraldAdapter { const FIELD_CONTENT_SOURCE = 'contentsource'; const FIELD_ALWAYS = 'always'; const FIELD_AUTHOR_PROJECTS = 'authorprojects'; + const FIELD_PROJECTS = 'projects'; const CONDITION_CONTAINS = 'contains'; const CONDITION_NOT_CONTAINS = '!contains'; @@ -154,6 +155,7 @@ abstract class HeraldAdapter { self::FIELD_CONTENT_SOURCE => pht('Content Source'), self::FIELD_ALWAYS => pht('Always'), self::FIELD_AUTHOR_PROJECTS => pht("Author's projects"), + self::FIELD_PROJECTS => pht("Projects"), ); } @@ -207,6 +209,7 @@ abstract class HeraldAdapter { case self::FIELD_REVIEWERS: case self::FIELD_CC: case self::FIELD_AUTHOR_PROJECTS: + case self::FIELD_PROJECTS: return array( self::CONDITION_INCLUDE_ALL, self::CONDITION_INCLUDE_ANY, @@ -600,6 +603,7 @@ abstract class HeraldAdapter { case self::FIELD_AFFECTED_PACKAGE: return self::VALUE_OWNERS_PACKAGE; case self::FIELD_AUTHOR_PROJECTS: + case self::FIELD_PROJECTS: return self::VALUE_PROJECT; case self::FIELD_REVIEWERS: return self::VALUE_USER_OR_PROJECT; diff --git a/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php b/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php index b4893b6eea..86622c7bc7 100644 --- a/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php +++ b/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php @@ -62,6 +62,7 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter { self::FIELD_AUTHOR, self::FIELD_CC, self::FIELD_CONTENT_SOURCE, + self::FIELD_PROJECTS, ), parent::getFields()); } @@ -103,6 +104,8 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter { return $this->getTask()->getAuthorPHID(); case self::FIELD_CC: return $this->getTask()->getCCPHIDs(); + case self::FIELD_PROJECTS: + return $this->getTask()->getProjectPHIDs(); } return parent::getHeraldField($field);