mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Use standard subscribers effects in Herald Adapter for Phriction
Summary: Ref T8455. Instead of using an ad-hoc subscribers effect in Phriction, use the new standard one (introduced previously; this depends on D13178). Test Plan: - Wrote an "add subscribers" Herald rule, updated a Phriction document, saw it apply its effect. - Observed availability of "remove" subscribers actions. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8455 Differential Revision: https://secure.phabricator.com/D13180
This commit is contained in:
parent
ee4c7268fe
commit
e2b0f814d4
2 changed files with 5 additions and 43 deletions
|
@ -776,24 +776,6 @@ final class PhrictionTransactionEditor
|
|||
->setDocument($object);
|
||||
}
|
||||
|
||||
protected function didApplyHeraldRules(
|
||||
PhabricatorLiskDAO $object,
|
||||
HeraldAdapter $adapter,
|
||||
HeraldTranscript $transcript) {
|
||||
|
||||
$xactions = array();
|
||||
|
||||
$cc_phids = $adapter->getCcPHIDs();
|
||||
if ($cc_phids) {
|
||||
$value = array_fuse($cc_phids);
|
||||
$xactions[] = id(new PhrictionTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
|
||||
->setNewValue(array('+' => $value));
|
||||
}
|
||||
|
||||
return $xactions;
|
||||
}
|
||||
|
||||
private function buildNewContentTemplate(
|
||||
PhrictionDocument $document) {
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
final class PhrictionDocumentHeraldAdapter extends HeraldAdapter {
|
||||
|
||||
private $document;
|
||||
private $ccPHIDs = array();
|
||||
|
||||
public function getAdapterApplicationClass() {
|
||||
return 'PhabricatorPhrictionApplication';
|
||||
|
@ -25,19 +24,11 @@ final class PhrictionDocumentHeraldAdapter extends HeraldAdapter {
|
|||
$this->document = $document;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDocument() {
|
||||
return $this->document;
|
||||
}
|
||||
|
||||
private function setCcPHIDs(array $cc_phids) {
|
||||
$this->ccPHIDs = $cc_phids;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCcPHIDs() {
|
||||
return $this->ccPHIDs;
|
||||
}
|
||||
|
||||
public function getAdapterContentName() {
|
||||
return pht('Phriction Documents');
|
||||
}
|
||||
|
@ -72,6 +63,7 @@ final class PhrictionDocumentHeraldAdapter extends HeraldAdapter {
|
|||
return array_merge(
|
||||
array(
|
||||
self::ACTION_ADD_CC,
|
||||
self::ACTION_REMOVE_CC,
|
||||
self::ACTION_EMAIL,
|
||||
self::ACTION_NOTHING,
|
||||
),
|
||||
|
@ -80,6 +72,7 @@ final class PhrictionDocumentHeraldAdapter extends HeraldAdapter {
|
|||
return array_merge(
|
||||
array(
|
||||
self::ACTION_ADD_CC,
|
||||
self::ACTION_REMOVE_CC,
|
||||
self::ACTION_EMAIL,
|
||||
self::ACTION_FLAG,
|
||||
self::ACTION_NOTHING,
|
||||
|
@ -116,22 +109,9 @@ final class PhrictionDocumentHeraldAdapter extends HeraldAdapter {
|
|||
|
||||
$result = array();
|
||||
foreach ($effects as $effect) {
|
||||
$action = $effect->getAction();
|
||||
switch ($action) {
|
||||
case self::ACTION_ADD_CC:
|
||||
foreach ($effect->getTarget() as $phid) {
|
||||
$this->ccPHIDs[] = $phid;
|
||||
}
|
||||
$result[] = new HeraldApplyTranscript(
|
||||
$effect,
|
||||
true,
|
||||
pht('Added address to cc list.'));
|
||||
break;
|
||||
default:
|
||||
$result[] = $this->applyStandardEffect($effect);
|
||||
break;
|
||||
}
|
||||
$result[] = $this->applyStandardEffect($effect);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue