From e2b0f814d47158ff6a532c4df8517210e2bc8cf2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 8 Jun 2015 10:31:09 -0700 Subject: [PATCH] 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 --- .../editor/PhrictionTransactionEditor.php | 18 ----------- .../herald/PhrictionDocumentHeraldAdapter.php | 30 ++++--------------- 2 files changed, 5 insertions(+), 43 deletions(-) diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php index bc5b24e8e6..b276aaf34a 100644 --- a/src/applications/phriction/editor/PhrictionTransactionEditor.php +++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php @@ -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) { diff --git a/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php b/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php index dd2f12f63b..72850bf94a 100644 --- a/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php +++ b/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php @@ -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; }