mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
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
This commit is contained in:
parent
8aeb7aa525
commit
97cd7a98b1
2 changed files with 44 additions and 4 deletions
|
@ -510,15 +510,23 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
||||||
}
|
}
|
||||||
|
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
$in_handles = $viewer->loadHandles($in_phids);
|
||||||
|
$out_handles = $viewer->loadHandles($out_phids);
|
||||||
|
|
||||||
|
$in_handles = $this->getCompleteHandles($in_handles);
|
||||||
|
$out_handles = $this->getCompleteHandles($out_handles);
|
||||||
|
|
||||||
|
if (!count($in_handles) && !count($out_handles)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$view = new PHUIPropertyListView();
|
$view = new PHUIPropertyListView();
|
||||||
|
|
||||||
if ($in_phids) {
|
if (count($in_handles)) {
|
||||||
$in_handles = $viewer->loadHandles($in_phids);
|
|
||||||
$view->addProperty(pht('Mentioned In'), $in_handles->renderList());
|
$view->addProperty(pht('Mentioned In'), $in_handles->renderList());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($out_phids) {
|
if (count($out_handles)) {
|
||||||
$out_handles = $viewer->loadHandles($out_phids);
|
|
||||||
$view->addProperty(pht('Mentioned Here'), $out_handles->renderList());
|
$view->addProperty(pht('Mentioned Here'), $out_handles->renderList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,4 +536,18 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
||||||
->appendChild($view);
|
->appendChild($view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getCompleteHandles(PhabricatorHandleList $handles) {
|
||||||
|
$phids = array();
|
||||||
|
|
||||||
|
foreach ($handles as $phid => $handle) {
|
||||||
|
if (!$handle->isComplete()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$phids[] = $phid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $handles->newSublist($phids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,24 @@ final class PhabricatorHandleList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new list with a subset of the PHIDs in this list.
|
||||||
|
*/
|
||||||
|
public function newSublist(array $phids) {
|
||||||
|
foreach ($phids as $phid) {
|
||||||
|
if (!isset($this[$phid])) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'Trying to create a new sublist of an existsing handle list, '.
|
||||||
|
'but PHID "%s" does not appear in the parent list.',
|
||||||
|
$phid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->handlePool->newHandleList($phids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( Rendering )---------------------------------------------------------- */
|
/* -( Rendering )---------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue