1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Support "Projects" field for pholio mocks in Herald

Summary: Mocks can have projects now; allow Herald rules to be written against them.

Test Plan: Wrote a Herald mock rule about projects.

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9552
This commit is contained in:
epriestley 2014-06-15 12:14:46 -07:00
parent e711a0ed30
commit 397d67ff3d
2 changed files with 9 additions and 6 deletions

View file

@ -4864,6 +4864,7 @@ phutil_register_library_map(array(
array( array(
0 => 'PhabricatorRepositoryDAO', 0 => 'PhabricatorRepositoryDAO',
1 => 'PhabricatorPolicyInterface', 1 => 'PhabricatorPolicyInterface',
2 => 'PhabricatorDestructableInterface',
), ),
'PhabricatorRepositoryArcanistProjectDeleteController' => 'PhabricatorRepositoryController', 'PhabricatorRepositoryArcanistProjectDeleteController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryArcanistProjectEditController' => 'PhabricatorRepositoryController', 'PhabricatorRepositoryArcanistProjectEditController' => 'PhabricatorRepositoryController',
@ -5329,6 +5330,7 @@ phutil_register_library_map(array(
5 => 'PhabricatorFlaggableInterface', 5 => 'PhabricatorFlaggableInterface',
6 => 'PhabricatorApplicationTransactionInterface', 6 => 'PhabricatorApplicationTransactionInterface',
7 => 'PhabricatorProjectInterface', 7 => 'PhabricatorProjectInterface',
8 => 'PhabricatorDestructableInterface',
), ),
'PholioMockCommentController' => 'PholioController', 'PholioMockCommentController' => 'PholioController',
'PholioMockEditController' => 'PholioController', 'PholioMockEditController' => 'PholioController',

View file

@ -1,8 +1,5 @@
<?php <?php
/**
* @group herald
*/
final class HeraldPholioMockAdapter extends HeraldAdapter { final class HeraldPholioMockAdapter extends HeraldAdapter {
private $mock; private $mock;
@ -13,8 +10,7 @@ final class HeraldPholioMockAdapter extends HeraldAdapter {
} }
public function getAdapterContentDescription() { public function getAdapterContentDescription() {
return pht( return pht('React to mocks being created or updated.');
'React to mocks being created or updated.');
} }
public function getObject() { public function getObject() {
@ -59,6 +55,7 @@ final class HeraldPholioMockAdapter extends HeraldAdapter {
self::FIELD_BODY, self::FIELD_BODY,
self::FIELD_AUTHOR, self::FIELD_AUTHOR,
self::FIELD_CC, self::FIELD_CC,
self::FIELD_PROJECTS,
self::FIELD_IS_NEW_OBJECT, self::FIELD_IS_NEW_OBJECT,
), ),
parent::getFields()); parent::getFields());
@ -98,7 +95,11 @@ final class HeraldPholioMockAdapter extends HeraldAdapter {
return $this->getMock()->getAuthorPHID(); return $this->getMock()->getAuthorPHID();
case self::FIELD_CC: case self::FIELD_CC:
return PhabricatorSubscribersQuery::loadSubscribersForPHID( return PhabricatorSubscribersQuery::loadSubscribersForPHID(
$this->getMock()->getPHID()); $this->getMock()->getPHID());
case self::FIELD_PROJECTS:
return PhabricatorEdgeQuery::loadDestinationPHIDs(
$this->getMock()->getPHID(),
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT);
} }
return parent::getHeraldField($field); return parent::getHeraldField($field);