From 6f6d88794b25ee24d9b1242937e21859c44ad543 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 3 Aug 2015 06:01:24 -0700 Subject: [PATCH] Modularize the Diffusion "Add Auditors" Herald action Ref T8726. --- .../sql/autopatches/20150803.herald.1.sql | 13 ++ src/__phutil_library_map__.php | 6 + .../audit/editor/PhabricatorAuditEditor.php | 26 +-- .../DifferentialReviewersHeraldAction.php | 2 +- ...ffusionAuditorsAddAuditorsHeraldAction.php | 33 +++ .../DiffusionAuditorsAddSelfHeraldAction.php | 30 +++ .../herald/DiffusionAuditorsHeraldAction.php | 76 +++++++ .../diffusion/herald/HeraldCommitAdapter.php | 51 ----- .../PhabricatorFlagAddFlagHeraldAction.php | 2 +- .../HarbormasterRunBuildPlansHeraldAction.php | 6 +- .../herald/action/HeraldAction.php | 188 +++++++++++++++++- .../herald/action/HeraldDoNothingAction.php | 2 +- .../herald/adapter/HeraldAdapter.php | 13 +- .../controller/HeraldTranscriptController.php | 2 +- .../LegalpadRequireSignatureHeraldAction.php | 2 +- .../ManiphestTaskAssignHeraldAction.php | 2 +- .../PhabricatorMetaMTAEmailHeraldAction.php | 2 +- .../herald/PhabricatorProjectHeraldAction.php | 2 +- .../PhabricatorSubscriptionsHeraldAction.php | 2 +- .../PhabricatorUSEnglishTranslation.php | 10 + 20 files changed, 365 insertions(+), 105 deletions(-) create mode 100644 resources/sql/autopatches/20150803.herald.1.sql create mode 100644 src/applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php create mode 100644 src/applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php create mode 100644 src/applications/diffusion/herald/DiffusionAuditorsHeraldAction.php diff --git a/resources/sql/autopatches/20150803.herald.1.sql b/resources/sql/autopatches/20150803.herald.1.sql new file mode 100644 index 0000000000..21f462b8c8 --- /dev/null +++ b/resources/sql/autopatches/20150803.herald.1.sql @@ -0,0 +1,13 @@ +UPDATE {$NAMESPACE}_herald.herald_action a + JOIN {$NAMESPACE}_herald.herald_rule r + ON a.ruleID = r.id + SET a.action = 'diffusion.auditors.add' + WHERE r.ruleType != 'personal' + AND a.action = 'audit'; + +UPDATE {$NAMESPACE}_herald.herald_action a + JOIN {$NAMESPACE}_herald.herald_rule r + ON a.ruleID = r.id + SET a.action = 'diffusion.auditors.self.add' + WHERE r.ruleType = 'personal' + AND a.action = 'audit'; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 08a183d20d..1d92b7a6de 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -498,6 +498,9 @@ phutil_register_library_map(array( 'DifferentialUpdateUnitResultsConduitAPIMethod' => 'applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php', 'DifferentialViewPolicyField' => 'applications/differential/customfield/DifferentialViewPolicyField.php', 'DiffusionAuditorDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorDatasource.php', + 'DiffusionAuditorsAddAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php', + 'DiffusionAuditorsAddSelfHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php', + 'DiffusionAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsHeraldAction.php', 'DiffusionBranchQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php', 'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php', 'DiffusionBranchTableView' => 'applications/diffusion/view/DiffusionBranchTableView.php', @@ -4129,6 +4132,9 @@ phutil_register_library_map(array( 'DifferentialUpdateUnitResultsConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialViewPolicyField' => 'DifferentialCoreCustomField', 'DiffusionAuditorDatasource' => 'PhabricatorTypeaheadCompositeDatasource', + 'DiffusionAuditorsAddAuditorsHeraldAction' => 'DiffusionAuditorsHeraldAction', + 'DiffusionAuditorsAddSelfHeraldAction' => 'DiffusionAuditorsHeraldAction', + 'DiffusionAuditorsHeraldAction' => 'HeraldAction', 'DiffusionBranchQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', 'DiffusionBranchTableController' => 'DiffusionController', 'DiffusionBranchTableView' => 'DiffusionView', diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index 2612cff04d..e9dd384812 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -877,30 +877,6 @@ final class PhabricatorAuditEditor HeraldAdapter $adapter, HeraldTranscript $transcript) { - $xactions = array(); - - $audit_phids = $adapter->getAuditMap(); - foreach ($audit_phids as $phid => $rule_ids) { - foreach ($rule_ids as $rule_id) { - $this->addAuditReason( - $phid, - pht( - '%s Triggered Audit', - "H{$rule_id}")); - } - } - - if ($audit_phids) { - $xactions[] = id(new PhabricatorAuditTransaction()) - ->setTransactionType(PhabricatorAuditActionConstants::ADD_AUDITORS) - ->setNewValue(array_fuse(array_keys($audit_phids))) - ->setMetadataValue( - 'auditStatus', - PhabricatorAuditStatusConstants::AUDIT_REQUIRED) - ->setMetadataValue( - 'auditReasonMap', $this->auditReasonMap); - } - $limit = self::MAX_FILES_SHOWN_IN_EMAIL; $files = $adapter->loadAffectedPaths(); sort($files); @@ -914,7 +890,7 @@ final class PhabricatorAuditEditor } $this->affectedFiles = implode("\n", $files); - return $xactions; + return array(); } private function isCommitMostlyImported(PhabricatorLiskDAO $object) { diff --git a/src/applications/differential/herald/DifferentialReviewersHeraldAction.php b/src/applications/differential/herald/DifferentialReviewersHeraldAction.php index 3694bdb087..848dfac9ff 100644 --- a/src/applications/differential/herald/DifferentialReviewersHeraldAction.php +++ b/src/applications/differential/herald/DifferentialReviewersHeraldAction.php @@ -200,7 +200,7 @@ abstract class DifferentialReviewersHeraldAction ); } - public function renderActionEffectDescription($type, $data) { + protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_NO_TARGETS: return pht('Rule lists no targets.'); diff --git a/src/applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php b/src/applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php new file mode 100644 index 0000000000..36b01b96f8 --- /dev/null +++ b/src/applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php @@ -0,0 +1,33 @@ +getRule(); + return $this->applyAuditors($effect->getTarget(), $rule); + } + + public function getHeraldActionStandardType() { + return self::STANDARD_PHID_LIST; + } + + protected function getDatasource() { + return new DiffusionAuditorDatasource(); + } + + public function renderActionDescription($value) { + return pht('Add auditors: %s.', $this->renderHandleList($value)); + } + +} diff --git a/src/applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php b/src/applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php new file mode 100644 index 0000000000..d27876d40e --- /dev/null +++ b/src/applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php @@ -0,0 +1,30 @@ +getRule(); + $phid = $rule->getAuthorPHID(); + return $this->applyAuditors(array($phid), $rule); + } + + public function getHeraldActionStandardType() { + return self::STANDARD_NONE; + } + + public function renderActionDescription($value) { + return pht('Add rule author as auditor.'); + } + +} diff --git a/src/applications/diffusion/herald/DiffusionAuditorsHeraldAction.php b/src/applications/diffusion/herald/DiffusionAuditorsHeraldAction.php new file mode 100644 index 0000000000..32830cb673 --- /dev/null +++ b/src/applications/diffusion/herald/DiffusionAuditorsHeraldAction.php @@ -0,0 +1,76 @@ +getAdapter(); + $object = $adapter->getObject(); + + $auditors = $object->getAudits(); + $auditors = mpull($auditors, null, 'getAuditorPHID'); + $current = array_keys($auditors); + + $allowed_types = array( + PhabricatorPeopleUserPHIDType::TYPECONST, + PhabricatorProjectProjectPHIDType::TYPECONST, + PhabricatorOwnersPackagePHIDType::TYPECONST, + ); + + $targets = $this->loadStandardTargets($phids, $allowed_types, $current); + if (!$targets) { + return; + } + + $phids = array_fuse(array_keys($targets)); + + // TODO: Convert this to be translatable, structured data eventually. + $reason_map = array(); + foreach ($phids as $phid) { + $reason_map[$phid][] = pht('%s Triggered Audit', $rule->getMonogram()); + } + + $xaction = $adapter->newTransaction() + ->setTransactionType(PhabricatorAuditActionConstants::ADD_AUDITORS) + ->setNewValue($phids) + ->setMetadataValue( + 'auditStatus', + PhabricatorAuditStatusConstants::AUDIT_REQUIRED) + ->setMetadataValue('auditReasonMap', $reason_map); + + $adapter->queueTransaction($xaction); + + $this->logEffect(self::DO_ADD_AUDITORS, $phids); + } + + protected function getActionEffectMap() { + return array( + self::DO_ADD_AUDITORS => array( + 'icon' => 'fa-user', + 'color' => 'green', + 'name' => pht('Added Auditors'), + ), + ); + } + + protected function renderActionEffectDescription($type, $data) { + switch ($type) { + case self::DO_ADD_AUDITORS: + return pht( + 'Added %s auditor(s): %s.', + new PhutilNumber(count($data)), + $this->renderHandleList($data)); + } + } + +} diff --git a/src/applications/diffusion/herald/HeraldCommitAdapter.php b/src/applications/diffusion/herald/HeraldCommitAdapter.php index 14f07fe575..ab3e850475 100644 --- a/src/applications/diffusion/herald/HeraldCommitAdapter.php +++ b/src/applications/diffusion/herald/HeraldCommitAdapter.php @@ -12,8 +12,6 @@ final class HeraldCommitAdapter protected $commitData; private $commitDiff; - protected $auditMap = array(); - protected $affectedPaths; protected $affectedRevision; protected $affectedPackages; @@ -86,24 +84,6 @@ final class HeraldCommitAdapter return pht('This rule can trigger for **repositories** and **projects**.'); } - public function getActions($rule_type) { - switch ($rule_type) { - case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL: - case HeraldRuleTypeConfig::RULE_TYPE_OBJECT: - return array_merge( - array( - self::ACTION_AUDIT, - ), - parent::getActions($rule_type)); - case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL: - return array_merge( - array( - self::ACTION_AUDIT, - ), - parent::getActions($rule_type)); - } - } - public static function newLegacyAdapter( PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit, @@ -149,10 +129,6 @@ final class HeraldCommitAdapter return $this; } - public function getAuditMap() { - return $this->auditMap; - } - public function getHeraldName() { return 'r'. @@ -322,33 +298,6 @@ final class HeraldCommitAdapter return $result; } - public function applyHeraldEffects(array $effects) { - assert_instances_of($effects, 'HeraldEffect'); - - $result = array(); - foreach ($effects as $effect) { - $action = $effect->getAction(); - switch ($action) { - case self::ACTION_AUDIT: - foreach ($effect->getTarget() as $phid) { - if (empty($this->auditMap[$phid])) { - $this->auditMap[$phid] = array(); - } - $this->auditMap[$phid][] = $effect->getRule()->getID(); - } - $result[] = new HeraldApplyTranscript( - $effect, - true, - pht('Triggered an audit.')); - break; - default: - $result[] = $this->applyStandardEffect($effect); - break; - } - } - return $result; - } - /* -( HarbormasterBuildableAdapterInterface )------------------------------ */ diff --git a/src/applications/flag/herald/PhabricatorFlagAddFlagHeraldAction.php b/src/applications/flag/herald/PhabricatorFlagAddFlagHeraldAction.php index 8c2490fd28..e4ae03915f 100644 --- a/src/applications/flag/herald/PhabricatorFlagAddFlagHeraldAction.php +++ b/src/applications/flag/herald/PhabricatorFlagAddFlagHeraldAction.php @@ -72,7 +72,7 @@ final class PhabricatorFlagAddFlagHeraldAction extends HeraldAction { return pht('Mark with %s flag.', $color); } - public function renderActionEffectDescription($type, $data) { + protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_IGNORE: return pht( diff --git a/src/applications/harbormaster/herald/HarbormasterRunBuildPlansHeraldAction.php b/src/applications/harbormaster/herald/HarbormasterRunBuildPlansHeraldAction.php index f06cdd1b26..82b9c09316 100644 --- a/src/applications/harbormaster/herald/HarbormasterRunBuildPlansHeraldAction.php +++ b/src/applications/harbormaster/herald/HarbormasterRunBuildPlansHeraldAction.php @@ -68,7 +68,7 @@ final class HarbormasterRunBuildPlansHeraldAction 'color' => 'red', 'name' => pht('Invalid Targets'), ), - self::DO_ALREADY_REQUIRED => array( + self::DO_BUILD => array( 'icon' => 'fa-play', 'color' => 'green', 'name' => pht('Building'), @@ -76,7 +76,7 @@ final class HarbormasterRunBuildPlansHeraldAction ); } - public function renderActionEffectDescription($type, $data) { + protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_NO_TARGETS: return pht('Rule lists no targets.'); @@ -85,7 +85,7 @@ final class HarbormasterRunBuildPlansHeraldAction '%s build plan(s) are not valid: %s.', new PhutilNumber(count($data)), $this->renderHandleList($data)); - case self::DO_REQUIRED: + case self::DO_BUILD: return pht( 'Started %s build(s): %s.', new PhutilNumber(count($data)), diff --git a/src/applications/herald/action/HeraldAction.php b/src/applications/herald/action/HeraldAction.php index 529f3b7471..2785e7d833 100644 --- a/src/applications/herald/action/HeraldAction.php +++ b/src/applications/herald/action/HeraldAction.php @@ -9,11 +9,20 @@ abstract class HeraldAction extends Phobject { const STANDARD_NONE = 'standard.none'; const STANDARD_PHID_LIST = 'standard.phid.list'; + const DO_STANDARD_EMPTY = 'do.standard.empty'; + const DO_STANDARD_NO_EFFECT = 'do.standard.no-effect'; + const DO_STANDARD_INVALID = 'do.standard.invalid'; + const DO_STANDARD_UNLOADABLE = 'do.standard.unloadable'; + const DO_STANDARD_PERMISSION = 'do.standard.permission'; + abstract public function getHeraldActionName(); abstract public function supportsObject($object); abstract public function supportsRuleType($rule_type); abstract public function applyEffect($object, HeraldEffect $effect); - abstract public function renderActionEffectDescription($type, $data); + + protected function renderActionEffectDescription($type, $data) { + return null; + } public function getActionGroupKey() { return null; @@ -154,21 +163,21 @@ abstract class HeraldAction extends Phobject { } private function getActionEffectSpec($type) { - $map = $this->getActionEffectMap(); + $map = $this->getActionEffectMap() + $this->getStandardEffectMap(); return idx($map, $type, array()); } - public function renderActionEffectIcon($type, $data) { + final public function renderActionEffectIcon($type, $data) { $map = $this->getActionEffectSpec($type); return idx($map, 'icon'); } - public function renderActionEffectColor($type, $data) { + final public function renderActionEffectColor($type, $data) { $map = $this->getActionEffectSpec($type); return idx($map, 'color'); } - public function renderActionEffectName($type, $data) { + final public function renderActionEffectName($type, $data) { $map = $this->getActionEffectSpec($type); return idx($map, 'name'); } @@ -184,4 +193,173 @@ abstract class HeraldAction extends Phobject { ->render(); } + protected function loadStandardTargets( + array $phids, + array $allowed_types, + array $current_value) { + + $phids = array_fuse($phids); + if (!$phids) { + $this->logEffect(self::DO_STANDARD_EMPTY); + } + + $current_value = array_fuse($current_value); + $no_effect = array(); + foreach ($phids as $phid) { + if (isset($current_value[$phid])) { + $no_effect[] = $phid; + unset($phids[$phid]); + } + } + + if ($no_effect) { + $this->logEffect(self::DO_STANDARD_NO_EFFECT, $no_effect); + } + + if (!$phids) { + return; + } + + $allowed_types = array_fuse($allowed_types); + $invalid = array(); + foreach ($phids as $phid) { + $type = phid_get_type($phid); + if ($type == PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN) { + $invalid[] = $phid; + unset($phids[$phid]); + continue; + } + + if ($allowed_types && empty($allowed_types[$type])) { + $invalid[] = $phid; + unset($phids[$phid]); + continue; + } + } + + if ($invalid) { + $this->logEffect(self::DO_STANDARD_INVALID, $invalid); + } + + if (!$phids) { + return; + } + + $targets = id(new PhabricatorObjectQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withPHIDs($phids) + ->execute(); + $targets = mpull($targets, null, 'getPHID'); + + $unloadable = array(); + foreach ($phids as $phid) { + if (empty($targets[$phid])) { + $unloadable[] = $phid; + unset($phids[$phid]); + } + } + + if ($unloadable) { + $this->logEffect(self::DO_STANDARD_UNLOADABLE, $unloadable); + } + + if (!$phids) { + return; + } + + $adapter = $this->getAdapter(); + $object = $adapter->getObject(); + + if ($object instanceof PhabricatorPolicyInterface) { + $no_permission = array(); + foreach ($targets as $phid => $target) { + if (!($target instanceof PhabricatorUser)) { + continue; + } + + $can_view = PhabricatorPolicyFilter::hasCapability( + $target, + $object, + PhabricatorPolicyCapability::CAN_VIEW); + if ($can_view) { + continue; + } + + $no_permission[] = $phid; + unset($targets[$phid]); + } + } + + if ($no_permission) { + $this->logEffect(self::DO_STANDARD_PERMISSION, $no_permission); + } + + return $targets; + } + + protected function getStandardEffectMap() { + return array( + self::DO_STANDARD_EMPTY => array( + 'icon' => 'fa-ban', + 'color' => 'grey', + 'name' => pht('No Targets'), + ), + self::DO_STANDARD_NO_EFFECT => array( + 'icon' => 'fa-circle-o', + 'color' => 'grey', + 'name' => pht('No Effect'), + ), + self::DO_STANDARD_INVALID => array( + 'icon' => 'fa-ban', + 'color' => 'red', + 'name' => pht('Invalid Targets'), + ), + self::DO_STANDARD_UNLOADABLE => array( + 'icon' => 'fa-ban', + 'color' => 'red', + 'name' => pht('Unloadable Targets'), + ), + self::DO_STANDARD_PERMISSION => array( + 'icon' => 'fa-lock', + 'color' => 'red', + 'name' => pht('No Permission'), + ), + ); + } + + final public function renderEffectDescription($type, $data) { + $result = $this->renderActionEffectDescription($type, $data); + if ($result !== null) { + return $result; + } + + switch ($type) { + case self::DO_STANDARD_EMPTY: + return pht( + 'This action specifies no targets.'); + case self::DO_STANDARD_NO_EFFECT: + return pht( + 'This action has no effect on %s target(s): %s.', + new PhutilNumber(count($data)), + $this->renderHandleList($data)); + case self::DO_STANDARD_INVALID: + return pht( + '%s target(s) are invalid or of the wrong type: %s.', + new PhutilNumber(count($data)), + $this->renderHandleList($data)); + case self::DO_STANDARD_UNLOADABLE: + return pht( + '%s target(s) could not be loaded: %s.', + new PhutilNumber(count($data)), + $this->renderHandleList($data)); + case self::DO_STANDARD_PERMISSION: + return pht( + '%s target(s) do not have permission to see this object: %s.', + new PhutilNumber(count($data)), + $this->renderHandleList($data)); + } + + return null; + } + } diff --git a/src/applications/herald/action/HeraldDoNothingAction.php b/src/applications/herald/action/HeraldDoNothingAction.php index 110e5707ac..21141bf47f 100644 --- a/src/applications/herald/action/HeraldDoNothingAction.php +++ b/src/applications/herald/action/HeraldDoNothingAction.php @@ -43,7 +43,7 @@ final class HeraldDoNothingAction extends HeraldAction { return pht('Do nothing.'); } - public function renderActionEffectDescription($type, $data) { + protected function renderActionEffectDescription($type, $data) { return pht('Did nothing.'); } diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php index 0c32d3238a..7f9c0665e7 100644 --- a/src/applications/herald/adapter/HeraldAdapter.php +++ b/src/applications/herald/adapter/HeraldAdapter.php @@ -26,7 +26,6 @@ abstract class HeraldAdapter extends Phobject { const CONDITION_IS_TRUE = 'true'; const CONDITION_IS_FALSE = 'false'; - const ACTION_AUDIT = 'audit'; const ACTION_BLOCK = 'block'; private $contentSource; @@ -712,13 +711,11 @@ abstract class HeraldAdapter extends Phobject { case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL: case HeraldRuleTypeConfig::RULE_TYPE_OBJECT: $standard = array( - self::ACTION_AUDIT => pht('Trigger an Audit by'), self::ACTION_BLOCK => pht('Block change with message'), ); break; case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL: $standard = array( - self::ACTION_AUDIT => pht('Trigger an Audit by me'), ); break; default: @@ -757,8 +754,6 @@ abstract class HeraldAdapter extends Phobject { $rule_type = $rule->getRuleType(); if ($rule_type == HeraldRuleTypeConfig::RULE_TYPE_PERSONAL) { switch ($action->getAction()) { - case self::ACTION_AUDIT: - break; case self::ACTION_BLOCK: break; default: @@ -790,14 +785,8 @@ abstract class HeraldAdapter extends Phobject { $is_personal = ($rule_type == HeraldRuleTypeConfig::RULE_TYPE_PERSONAL); - if ($is_personal) { + if (!$is_personal) { switch ($action) { - case self::ACTION_AUDIT: - return new HeraldEmptyFieldValue(); - } - } else { - switch ($action) { - case self::ACTION_AUDIT: case self::ACTION_BLOCK: return new HeraldTextFieldValue(); } diff --git a/src/applications/herald/controller/HeraldTranscriptController.php b/src/applications/herald/controller/HeraldTranscriptController.php index f0bad8d393..64563b7ef8 100644 --- a/src/applications/herald/controller/HeraldTranscriptController.php +++ b/src/applications/herald/controller/HeraldTranscriptController.php @@ -376,7 +376,7 @@ final class HeraldTranscriptController extends HeraldController { $icon = $action->renderActionEffectIcon($type, $data); $color = $action->renderActionEffectColor($type, $data); $name = $action->renderActionEffectName($type, $data); - $note = $action->renderActionEffectDescription($type, $data); + $note = $action->renderEffectDescription($type, $data); } else { $icon = 'fa-question-circle'; $color = 'indigo'; diff --git a/src/applications/legalpad/herald/LegalpadRequireSignatureHeraldAction.php b/src/applications/legalpad/herald/LegalpadRequireSignatureHeraldAction.php index 092840df68..9ff4c08b13 100644 --- a/src/applications/legalpad/herald/LegalpadRequireSignatureHeraldAction.php +++ b/src/applications/legalpad/herald/LegalpadRequireSignatureHeraldAction.php @@ -142,7 +142,7 @@ final class LegalpadRequireSignatureHeraldAction ); } - public function renderActionEffectDescription($type, $data) { + protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_NO_TARGETS: return pht('Rule lists no targets.'); diff --git a/src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php b/src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php index 9e031bc8b5..169446f7cf 100644 --- a/src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php +++ b/src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php @@ -90,7 +90,7 @@ abstract class ManiphestTaskAssignHeraldAction ); } - public function renderActionEffectDescription($type, $data) { + protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_EMPTY: return pht('Action lists no user to assign.'); diff --git a/src/applications/metamta/herald/PhabricatorMetaMTAEmailHeraldAction.php b/src/applications/metamta/herald/PhabricatorMetaMTAEmailHeraldAction.php index 07f216447d..60e72ce26a 100644 --- a/src/applications/metamta/herald/PhabricatorMetaMTAEmailHeraldAction.php +++ b/src/applications/metamta/herald/PhabricatorMetaMTAEmailHeraldAction.php @@ -50,7 +50,7 @@ abstract class PhabricatorMetaMTAEmailHeraldAction ); } - public function renderActionEffectDescription($type, $data) { + protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_SEND: return pht( diff --git a/src/applications/project/herald/PhabricatorProjectHeraldAction.php b/src/applications/project/herald/PhabricatorProjectHeraldAction.php index 599a218213..2d8c2c9b48 100644 --- a/src/applications/project/herald/PhabricatorProjectHeraldAction.php +++ b/src/applications/project/herald/PhabricatorProjectHeraldAction.php @@ -145,7 +145,7 @@ abstract class PhabricatorProjectHeraldAction ); } - public function renderActionEffectDescription($type, $data) { + protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_NO_TARGETS: return pht('Rule lists no projects.'); diff --git a/src/applications/subscriptions/herald/PhabricatorSubscriptionsHeraldAction.php b/src/applications/subscriptions/herald/PhabricatorSubscriptionsHeraldAction.php index 374fcfa1fb..5ac859a527 100644 --- a/src/applications/subscriptions/herald/PhabricatorSubscriptionsHeraldAction.php +++ b/src/applications/subscriptions/herald/PhabricatorSubscriptionsHeraldAction.php @@ -196,7 +196,7 @@ abstract class PhabricatorSubscriptionsHeraldAction ); } - public function renderActionEffectDescription($type, $data) { + protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_NO_TARGETS: return pht('Rule lists no targets.'); diff --git a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php index 00bc82305c..108319139d 100644 --- a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php +++ b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php @@ -1338,6 +1338,16 @@ final class PhabricatorUSEnglishTranslation 'Required signatures: %2$s.', ), + 'Started %s build(s): %s.' => array( + 'Started a build: %2$s.', + 'Started builds: %2$s.', + ), + + 'Added %s auditor(s): %s.' => array( + 'Added an auditor: %2$s.', + 'Added auditors: %2$s.', + ), + ); }