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

View file

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