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

Audit - fix erroneous mentions of tasks, etc via commit message

Summary: we don't want to mention these phids... when expanding transactions, build the unmnentionable map and make it so. slightly hairy due to how the editor framework works, but overall i think this is the right place to put these hooks. Fixes T6331.

Test Plan: made a commit with a commit message that had fixes, refs, depends on, and auditors and saw no erroneous mentions

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, chad, epriestley

Maniphest Tasks: T6331

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

+59
+59
src/applications/audit/editor/PhabricatorAuditEditor.php
··· 321 321 $object); 322 322 if ($request) { 323 323 $xactions[] = $request; 324 + $this->setUnmentionablePHIDMap($request->getNewValue()); 324 325 } 325 326 break; 326 327 default: ··· 447 448 protected function supportsSearch() { 448 449 return true; 449 450 } 451 + 452 + protected function expandCustomRemarkupBlockTransactions( 453 + PhabricatorLiskDAO $object, 454 + array $xactions, 455 + $blocks, 456 + PhutilMarkupEngine $engine) { 457 + 458 + // we are only really trying to find unmentionable phids here... 459 + // don't bother with this outside initial commit (i.e. create) 460 + // transaction 461 + $is_commit = false; 462 + foreach ($xactions as $xaction) { 463 + switch ($xaction->getTransactionType()) { 464 + case PhabricatorAuditTransaction::TYPE_COMMIT: 465 + $is_commit = true; 466 + break; 467 + } 468 + } 469 + 470 + // "result" is always an array.... 471 + $result = array(); 472 + if (!$is_commit) { 473 + return $result; 474 + } 475 + 476 + $flat_blocks = array_mergev($blocks); 477 + $huge_block = implode("\n\n", $flat_blocks); 478 + $phid_map = array(); 479 + $phid_map[] = $this->getUnmentionablePHIDMap(); 480 + $monograms = array(); 481 + 482 + $task_refs = id(new ManiphestCustomFieldStatusParser()) 483 + ->parseCorpus($huge_block); 484 + foreach ($task_refs as $match) { 485 + foreach ($match['monograms'] as $monogram) { 486 + $monograms[] = $monogram; 487 + } 488 + } 489 + 490 + $rev_refs = id(new DifferentialCustomFieldDependsOnParser()) 491 + ->parseCorpus($huge_block); 492 + foreach ($rev_refs as $match) { 493 + foreach ($match['monograms'] as $monogram) { 494 + $monograms[] = $monogram; 495 + } 496 + } 497 + 498 + $objects = id(new PhabricatorObjectQuery()) 499 + ->setViewer($this->getActor()) 500 + ->withNames($monograms) 501 + ->execute(); 502 + $phid_map[] = mpull($objects, 'getPHID', 'getPHID'); 503 + $phid_map = array_mergev($phid_map); 504 + $this->setUnmentionablePHIDMap($phid_map); 505 + 506 + return $result; 507 + } 508 + 450 509 451 510 protected function shouldSendMail( 452 511 PhabricatorLiskDAO $object,