mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 17:52:43 +01:00
1e2718d747
Summary: Ref T603. Basically: - Hide "Reports". - Hide "batch edit" and "export to excel". - Hide reprioritization controls. - I left the edit controls, they show a "login to continue" dialog when hit. - Allow tokenizer results to fill for public users. - Fix a bug where membership in projects was computed incorrectly in certain cases. - Add a unit test covering the project membership bug. Test Plan: Viewed /maniphest/ when logged out, and while logged in. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T603 Differential Revision: https://secure.phabricator.com/D7126
70 lines
1.7 KiB
PHP
70 lines
1.7 KiB
PHP
<?php
|
|
|
|
abstract class ManiphestController extends PhabricatorController {
|
|
|
|
public function buildApplicationMenu() {
|
|
return $this->buildSideNavView(true)->getMenu();
|
|
}
|
|
|
|
public function buildSideNavView($for_app = false) {
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
if ($for_app) {
|
|
$nav->addFilter('create', pht('Create Task'));
|
|
}
|
|
|
|
id(new ManiphestTaskSearchEngine())
|
|
->setViewer($user)
|
|
->addNavigationItems($nav->getMenu());
|
|
|
|
if ($user->isLoggedIn()) {
|
|
// For now, don't give logged-out users access to reports.
|
|
$nav->addLabel(pht('Reports'));
|
|
$nav->addFilter('report', pht('Reports'));
|
|
}
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
return $nav;
|
|
}
|
|
|
|
protected function buildApplicationCrumbs() {
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$crumbs->addAction(
|
|
id(new PHUIListItemView())
|
|
->setName(pht('Create Task'))
|
|
->setHref($this->getApplicationURI('task/create/'))
|
|
->setIcon('create'));
|
|
|
|
return $crumbs;
|
|
}
|
|
|
|
protected function renderSingleTask(ManiphestTask $task) {
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
$phids = $task->getProjectPHIDs();
|
|
if ($task->getOwnerPHID()) {
|
|
$phids[] = $task->getOwnerPHID();
|
|
}
|
|
|
|
$handles = id(new PhabricatorHandleQuery())
|
|
->setViewer($user)
|
|
->withPHIDs($phids)
|
|
->execute();
|
|
|
|
$view = id(new ManiphestTaskListView())
|
|
->setUser($user)
|
|
->setShowSubpriorityControls(true)
|
|
->setShowBatchControls(true)
|
|
->setHandles($handles)
|
|
->setTasks(array($task));
|
|
|
|
return $view;
|
|
}
|
|
|
|
|
|
}
|