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

Fix an issue with "Auditors:" where an edge edit was used as a PHID list

Summary:
See <https://discourse.phabricator-community.org/t/runtimeexception-during-import-of-commit/3801>. When importing commits with "Auditors:", a raw transaction new value (with an edge edit map using a "+" key) may be passed as an unmentionable PHID list.

Instead, pass an actual PHID list.

Test Plan:
- Pushed a commit with "Auditors: duck".
- Ran daemons.
- Before patch: umentionable PHID exception.
- After patch: clean commit import.
- Verified "duck" was added as an auditor.

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

+14 -11
+14 -11
src/applications/audit/editor/PhabricatorAuditEditor.php
··· 232 232 PhabricatorLiskDAO $object, 233 233 PhabricatorApplicationTransaction $xaction) { 234 234 235 + $auditors_type = DiffusionCommitAuditorsTransaction::TRANSACTIONTYPE; 236 + 235 237 $xactions = parent::expandTransaction($object, $xaction); 238 + 236 239 switch ($xaction->getTransactionType()) { 237 240 case PhabricatorAuditTransaction::TYPE_COMMIT: 238 - $request = $this->createAuditRequestTransactionFromCommitMessage( 241 + $phids = $this->getAuditRequestTransactionPHIDsFromCommitMessage( 239 242 $object); 240 - if ($request) { 241 - $xactions[] = $request; 242 - $this->addUnmentionablePHIDs($request->getNewValue()); 243 + if ($phids) { 244 + $xactions[] = $object->getApplicationTransactionTemplate() 245 + ->setTransactionType($auditors_type) 246 + ->setNewValue( 247 + array( 248 + '+' => array_fuse($phids), 249 + )); 250 + $this->addUnmentionablePHIDs($phids); 243 251 } 244 252 break; 245 253 default: ··· 268 276 return $xactions; 269 277 } 270 278 271 - private function createAuditRequestTransactionFromCommitMessage( 279 + private function getAuditRequestTransactionPHIDsFromCommitMessage( 272 280 PhabricatorRepositoryCommit $commit) { 273 281 274 282 $actor = $this->getActor(); ··· 297 305 return array(); 298 306 } 299 307 300 - return $commit->getApplicationTransactionTemplate() 301 - ->setTransactionType(DiffusionCommitAuditorsTransaction::TRANSACTIONTYPE) 302 - ->setNewValue( 303 - array( 304 - '+' => array_fuse($phids), 305 - )); 308 + return $phids; 306 309 } 307 310 308 311 protected function sortTransactions(array $xactions) {