@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add an "Acting user" field to Herald

Summary:
Ref T13053. Fixes T7804. Adds "Acting user" so you can have "always email me" stuff skip things you did or keep an eye on suspicious interns.

For the test console, the current user is the acting user.

For pushes, the pusher is the acting user.

Test Plan: Wrote acting user rules, triggered them via test console and via multiple actors on real objects.

Maniphest Tasks: T13053, T7804

Differential Revision: https://secure.phabricator.com/D19031

+51 -1
+2
src/__phutil_library_map__.php
··· 1346 1346 'HarbormasterWaitForPreviousBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterWaitForPreviousBuildStepImplementation.php', 1347 1347 'HarbormasterWorker' => 'applications/harbormaster/worker/HarbormasterWorker.php', 1348 1348 'HarbormasterWorkingCopyArtifact' => 'applications/harbormaster/artifact/HarbormasterWorkingCopyArtifact.php', 1349 + 'HeraldActingUserField' => 'applications/herald/field/HeraldActingUserField.php', 1349 1350 'HeraldAction' => 'applications/herald/action/HeraldAction.php', 1350 1351 'HeraldActionGroup' => 'applications/herald/action/HeraldActionGroup.php', 1351 1352 'HeraldActionRecord' => 'applications/herald/storage/HeraldActionRecord.php', ··· 6589 6590 'HarbormasterWaitForPreviousBuildStepImplementation' => 'HarbormasterBuildStepImplementation', 6590 6591 'HarbormasterWorker' => 'PhabricatorWorker', 6591 6592 'HarbormasterWorkingCopyArtifact' => 'HarbormasterDrydockLeaseArtifact', 6593 + 'HeraldActingUserField' => 'HeraldField', 6592 6594 'HeraldAction' => 'Phobject', 6593 6595 'HeraldActionGroup' => 'HeraldGroup', 6594 6596 'HeraldActionRecord' => 'HeraldDAO',
+5 -1
src/applications/diffusion/engine/DiffusionCommitHookEngine.php
··· 297 297 return; 298 298 } 299 299 300 - $adapter_template->setHookEngine($this); 300 + $viewer = $this->getViewer(); 301 + 302 + $adapter_template 303 + ->setHookEngine($this) 304 + ->setActingAsPHID($viewer->getPHID()); 301 305 302 306 $engine = new HeraldEngine(); 303 307 $rules = null;
+10
src/applications/herald/adapter/HeraldAdapter.php
··· 40 40 private $forbiddenActions = array(); 41 41 private $viewer; 42 42 private $mustEncryptReasons = array(); 43 + private $actingAsPHID; 43 44 44 45 public function getEmailPHIDs() { 45 46 return array_values($this->emailPHIDs); ··· 47 48 48 49 public function getForcedEmailPHIDs() { 49 50 return array_values($this->forcedEmailPHIDs); 51 + } 52 + 53 + final public function setActingAsPHID($acting_as_phid) { 54 + $this->actingAsPHID = $acting_as_phid; 55 + return $this; 56 + } 57 + 58 + final public function getActingAsPHID() { 59 + return $this->actingAsPHID; 50 60 } 51 61 52 62 public function addEmailPHID($phid, $force) {
+1
src/applications/herald/controller/HeraldTestConsoleController.php
··· 41 41 42 42 $adapter 43 43 ->setIsNewObject(false) 44 + ->setActingAsPHID($viewer->getPHID()) 44 45 ->setViewer($viewer); 45 46 46 47 $rules = id(new HeraldRuleQuery())
+32
src/applications/herald/field/HeraldActingUserField.php
··· 1 + <?php 2 + 3 + final class HeraldActingUserField 4 + extends HeraldField { 5 + 6 + const FIELDCONST = 'herald.acting-user'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht('Acting user'); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + return $this->getAdapter()->getActingAsPHID(); 14 + } 15 + 16 + protected function getHeraldFieldStandardType() { 17 + return self::STANDARD_PHID; 18 + } 19 + 20 + protected function getDatasource() { 21 + return new PhabricatorPeopleDatasource(); 22 + } 23 + 24 + public function supportsObject($object) { 25 + return true; 26 + } 27 + 28 + public function getFieldGroupKey() { 29 + return HeraldEditFieldGroup::FIELDGROUPKEY; 30 + } 31 + 32 + }
+1
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 3254 3254 $adapter = $this->buildHeraldAdapter($object, $xactions) 3255 3255 ->setContentSource($this->getContentSource()) 3256 3256 ->setIsNewObject($this->getIsNewObject()) 3257 + ->setActingAsPHID($this->getActingAsPHID()) 3257 3258 ->setAppliedTransactions($xactions); 3258 3259 3259 3260 if ($this->getApplicationEmail()) {