From e6190ffc6770fa191ec46fc8ae0f059ac69c5566 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 24 Jun 2014 15:59:06 -0700 Subject: [PATCH] Disable Maniphest task list grips in panel rendering contexts Summary: Fixes T5467. - Let search engines figure out if they're rendering for a panel or not. - If Maniphest is rendering a panel, turn off the grips and batch selection. Test Plan: - Viewed task panels (no grips). - Viewed non-panel query results (grips). Reviewers: chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T5467 Differential Revision: https://secure.phabricator.com/D9714 --- .../PhabricatorDashboardPanelTypeQuery.php | 1 + .../query/ManiphestTaskSearchEngine.php | 21 ++++++++++++------- .../PhabricatorApplicationSearchEngine.php | 13 ++++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeQuery.php b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeQuery.php index bae946d1fb..1b6788dd5e 100644 --- a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeQuery.php +++ b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeQuery.php @@ -80,6 +80,7 @@ final class PhabricatorDashboardPanelTypeQuery } $engine->setViewer($viewer); + $engine->setContext(PhabricatorApplicationSearchEngine::CONTEXT_PANEL); $key = $panel->getProperty('key'); if ($engine->isBuiltinQuery($key)) { diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php index 4372996aa8..501e095aba 100644 --- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php +++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php @@ -532,15 +532,20 @@ final class ManiphestTaskSearchEngine $viewer = $this->requireViewer(); - $can_edit_priority = PhabricatorPolicyFilter::hasCapability( - $viewer, - $this->getApplication(), - ManiphestCapabilityEditPriority::CAPABILITY); + if ($this->isPanelContext()) { + $can_edit_priority = false; + $can_bulk_edit = false; + } else { + $can_edit_priority = PhabricatorPolicyFilter::hasCapability( + $viewer, + $this->getApplication(), + ManiphestCapabilityEditPriority::CAPABILITY); - $can_bulk_edit = PhabricatorPolicyFilter::hasCapability( - $viewer, - $this->getApplication(), - ManiphestCapabilityBulkEdit::CAPABILITY); + $can_bulk_edit = PhabricatorPolicyFilter::hasCapability( + $viewer, + $this->getApplication(), + ManiphestCapabilityBulkEdit::CAPABILITY); + } return id(new ManiphestTaskResultListView()) ->setUser($viewer) diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php index 0869739d6d..9dd2519ff0 100644 --- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php +++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php @@ -22,6 +22,10 @@ abstract class PhabricatorApplicationSearchEngine { private $errors = array(); private $customFields = false; private $request; + private $context; + + const CONTEXT_LIST = 'list'; + const CONTEXT_PANEL = 'panel'; public function setViewer(PhabricatorUser $viewer) { $this->viewer = $viewer; @@ -35,6 +39,15 @@ abstract class PhabricatorApplicationSearchEngine { return $this->viewer; } + public function setContext($context) { + $this->context = $context; + return $this; + } + + public function isPanelContext() { + return ($this->context == self::CONTEXT_PANEL); + } + public function saveQuery(PhabricatorSavedQuery $query) { $query->setEngineClassName(get_class($this));