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

Strip restricted and incomplete handles from the "Mentions" tab on Maniphest tasks

Summary:
Ref T8345. See T8345#201048 for discussion.

This rule (don't show mentions of or from restricted objects) is more consistent with how we render mentions in the timeline and I think generally a better behavior.

Test Plan:
- Mentioned a task on a public task and a private task.
- Privileged user (foreground) sees both.
- Public user (background) sees only the public mention.

{F1929485}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8345

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

+44 -4
+26 -4
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 510 510 } 511 511 512 512 $viewer = $this->getViewer(); 513 + $in_handles = $viewer->loadHandles($in_phids); 514 + $out_handles = $viewer->loadHandles($out_phids); 515 + 516 + $in_handles = $this->getCompleteHandles($in_handles); 517 + $out_handles = $this->getCompleteHandles($out_handles); 518 + 519 + if (!count($in_handles) && !count($out_handles)) { 520 + return null; 521 + } 522 + 513 523 $view = new PHUIPropertyListView(); 514 524 515 - if ($in_phids) { 516 - $in_handles = $viewer->loadHandles($in_phids); 525 + if (count($in_handles)) { 517 526 $view->addProperty(pht('Mentioned In'), $in_handles->renderList()); 518 527 } 519 528 520 - if ($out_phids) { 521 - $out_handles = $viewer->loadHandles($out_phids); 529 + if (count($out_handles)) { 522 530 $view->addProperty(pht('Mentioned Here'), $out_handles->renderList()); 523 531 } 524 532 ··· 527 535 ->setKey('mentions') 528 536 ->appendChild($view); 529 537 } 538 + 539 + private function getCompleteHandles(PhabricatorHandleList $handles) { 540 + $phids = array(); 541 + 542 + foreach ($handles as $phid => $handle) { 543 + if (!$handle->isComplete()) { 544 + continue; 545 + } 546 + $phids[] = $phid; 547 + } 548 + 549 + return $handles->newSublist($phids); 550 + } 551 + 530 552 531 553 }
+18
src/applications/phid/handle/pool/PhabricatorHandleList.php
··· 74 74 } 75 75 76 76 77 + /** 78 + * Create a new list with a subset of the PHIDs in this list. 79 + */ 80 + public function newSublist(array $phids) { 81 + foreach ($phids as $phid) { 82 + if (!isset($this[$phid])) { 83 + throw new Exception( 84 + pht( 85 + 'Trying to create a new sublist of an existsing handle list, '. 86 + 'but PHID "%s" does not appear in the parent list.', 87 + $phid)); 88 + } 89 + } 90 + 91 + return $this->handlePool->newHandleList($phids); 92 + } 93 + 94 + 77 95 /* -( Rendering )---------------------------------------------------------- */ 78 96 79 97