Commit 287324d0 authored by Daniel Stone's avatar Daniel Stone Committed by Ana Rute Mendes
Browse files

WIP: Maniphest: Hide hidden project tags for tasks

If the viewer doesn't have permission to see something a task has been
tagged with, then don't show it to them in the Maniphest task list view,
the task detail view, or the workboard view.

This should be extended further to also eliminate it from the
transaction history (in the task detail view) and also from
notifications, but it's a start.

This would need quite a bit more work to go upstream.
parent bbc9a7d7
...@@ -110,6 +110,11 @@ final class ManiphestTaskListView extends ManiphestView { ...@@ -110,6 +110,11 @@ final class ManiphestTaskListView extends ManiphestView {
$project_handles = array_select_keys( $project_handles = array_select_keys(
$handles, $handles,
array_reverse($task->getProjectPHIDs())); array_reverse($task->getProjectPHIDs()));
foreach ($project_handles as $key => $project_handle) {
if ($project_handle->getPolicyFiltered()) {
unset($project_handles[$key]);
}
}
$item->addAttribute( $item->addAttribute(
id(new PHUIHandleTagListView()) id(new PHUIHandleTagListView())
......
...@@ -23,6 +23,16 @@ final class PhabricatorProjectsCurtainExtension ...@@ -23,6 +23,16 @@ final class PhabricatorProjectsCurtainExtension
$has_projects = (bool)$project_phids; $has_projects = (bool)$project_phids;
$project_phids = array_reverse($project_phids); $project_phids = array_reverse($project_phids);
$handles = $viewer->loadHandles($project_phids); $handles = $viewer->loadHandles($project_phids);
$handles = iterator_to_array($handles);
foreach ($handles as $key => $handle) {
if ($handle->getPolicyFiltered()) {
unset($handles[$key]);
}
}
if (empty($handles)) {
$has_projects = false;
}
// If this object can appear on boards, build the workboard annotations. // If this object can appear on boards, build the workboard annotations.
// Some day, this might be a generic interface. For now, only tasks can // Some day, this might be a generic interface. For now, only tasks can
...@@ -40,9 +50,7 @@ final class PhabricatorProjectsCurtainExtension ...@@ -40,9 +50,7 @@ final class PhabricatorProjectsCurtainExtension
// TDOO: Generalize this UI and move it out of Maniphest. // TDOO: Generalize this UI and move it out of Maniphest.
require_celerity_resource('maniphest-task-summary-css'); require_celerity_resource('maniphest-task-summary-css');
foreach ($project_phids as $project_phid) { foreach ($handles as $project_phid => $handle) {
$handle = $handles[$project_phid];
$columns = $engine->getObjectColumns( $columns = $engine->getObjectColumns(
$project_phid, $project_phid,
$object->getPHID()); $object->getPHID());
......
...@@ -159,13 +159,13 @@ final class ProjectBoardTaskCard extends Phobject { ...@@ -159,13 +159,13 @@ final class ProjectBoardTaskCard extends Phobject {
$project_handles = $this->getProjectHandles(); $project_handles = $this->getProjectHandles();
// Remove any archived projects from the list. // Remove any archived or hidden projects from the list.
if ($this->hideArchivedProjects) { if ($project_handles) {
if ($project_handles) { foreach ($project_handles as $key => $handle) {
foreach ($project_handles as $key => $handle) { if ($handle->getPolicyFiltered() ||
if ($handle->getStatus() == PhabricatorObjectHandle::STATUS_CLOSED) { ($this->hideArchivedProjects &&
unset($project_handles[$key]); $handle->getStatus() == PhabricatorObjectHandle::STATUS_CLOSED)) {
} unset($project_handles[$key]);
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment