1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

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
This commit is contained in:
epriestley 2014-06-24 15:59:06 -07:00
parent 454b773f78
commit e6190ffc67
3 changed files with 27 additions and 8 deletions

View file

@ -80,6 +80,7 @@ final class PhabricatorDashboardPanelTypeQuery
}
$engine->setViewer($viewer);
$engine->setContext(PhabricatorApplicationSearchEngine::CONTEXT_PANEL);
$key = $panel->getProperty('key');
if ($engine->isBuiltinQuery($key)) {

View file

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

View file

@ -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));