@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.

Herald - Add "new" field to herald

Summary: ...and surface it in all adapters except commit adapters. Values are true or false. Ref T4294

Test Plan: made a herald rule to be cc'd on new tasks. was cc'd on new tasks and not cc'd on updates to existing tasks.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4294

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

+23
+1
src/applications/differential/editor/DifferentialRevisionEditor.php
··· 256 256 $adapter->setExplicitCCs($new['ccs']); 257 257 $adapter->setExplicitReviewers($new['rev']); 258 258 $adapter->setForbiddenCCs($revision->loadUnsubscribedPHIDs()); 259 + $adapter->setIsNewObject($is_new); 259 260 260 261 $xscript = HeraldEngine::loadAndApplyRules($adapter); 261 262 $xscript_uri = '/herald/transcript/'.$xscript->getID().'/';
+18
src/applications/herald/adapter/HeraldAdapter.php
··· 38 38 const FIELD_BRANCHES = 'branches'; 39 39 const FIELD_AUTHOR_RAW = 'author-raw'; 40 40 const FIELD_COMMITTER_RAW = 'committer-raw'; 41 + const FIELD_IS_NEW_OBJECT = 'new-object'; 41 42 42 43 const CONDITION_CONTAINS = 'contains'; 43 44 const CONDITION_NOT_CONTAINS = '!contains'; ··· 90 91 const VALUE_BUILD_PLAN = 'buildplan'; 91 92 92 93 private $contentSource; 94 + private $isNewObject; 93 95 94 96 public function setContentSource(PhabricatorContentSource $content_source) { 95 97 $this->contentSource = $content_source; ··· 99 101 return $this->contentSource; 100 102 } 101 103 104 + public function getIsNewObject() { 105 + if (is_bool($this->isNewObject)) { 106 + return $this->isNewObject; 107 + } 108 + 109 + throw new Exception(pht('You must setIsNewObject to a boolean first!')); 110 + } 111 + public function setIsNewObject($new) { 112 + $this->isNewObject = (bool) $new; 113 + return $this; 114 + } 115 + 102 116 abstract public function getPHID(); 103 117 abstract public function getHeraldName(); 104 118 ··· 110 124 return $this->getContentSource()->getSource(); 111 125 case self::FIELD_ALWAYS: 112 126 return true; 127 + case self::FIELD_IS_NEW_OBJECT: 128 + return $this->getIsNewObject(); 113 129 default: 114 130 throw new Exception( 115 131 "Unknown field '{$field_name}'!"); ··· 216 232 self::FIELD_BRANCHES => pht('Commit\'s branches'), 217 233 self::FIELD_AUTHOR_RAW => pht('Raw author name'), 218 234 self::FIELD_COMMITTER_RAW => pht('Raw committer name'), 235 + self::FIELD_IS_NEW_OBJECT => pht('Is newly created?'), 219 236 ); 220 237 } 221 238 ··· 345 362 ); 346 363 case self::FIELD_IS_MERGE_COMMIT: 347 364 case self::FIELD_DIFF_ENORMOUS: 365 + case self::FIELD_IS_NEW_OBJECT: 348 366 return array( 349 367 self::CONDITION_IS_TRUE, 350 368 self::CONDITION_IS_FALSE,
+1
src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
··· 72 72 self::FIELD_RULE, 73 73 self::FIELD_AFFECTED_PACKAGE, 74 74 self::FIELD_AFFECTED_PACKAGE_OWNER, 75 + self::FIELD_OBJECT_IS_NEW, 75 76 ), 76 77 parent::getFields()); 77 78 }
+1
src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
··· 80 80 self::FIELD_CC, 81 81 self::FIELD_CONTENT_SOURCE, 82 82 self::FIELD_PROJECTS, 83 + self::FIELD_IS_NEW_OBJECT, 83 84 ), 84 85 parent::getFields()); 85 86 }
+1
src/applications/herald/adapter/HeraldPholioMockAdapter.php
··· 59 59 self::FIELD_BODY, 60 60 self::FIELD_AUTHOR, 61 61 self::FIELD_CC, 62 + self::FIELD_OBJECT_IS_NEW, 62 63 ), 63 64 parent::getFields()); 64 65 }
+1
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 1554 1554 1555 1555 $adapter = $this->buildHeraldAdapter($object, $xactions); 1556 1556 $adapter->setContentSource($this->getContentSource()); 1557 + $adapter->setIsNewObject($this->getIsNewObject()); 1557 1558 $xscript = HeraldEngine::loadAndApplyRules($adapter); 1558 1559 1559 1560 $this->setHeraldAdapter($adapter);