@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Introduce ManiphestTaskSearchEngine plus ManiphestTaskListControllerPro

Summary:
Ref T603. Ref T2625. Cutting this over is tricky because of Maniphest's existing saved queries. Plan here is:

- Build out the "pro" controller at `/maniphest/query/`.
- Once it's at parity, migrate custom queries.
- Nuke the old UI.

This provides a minimal implementation with no filter support.

Test Plan: Looked at `/maniphest/query/`, saw results technically available.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603, T2625

Differential Revision: https://secure.phabricator.com/D6933

+136
+8
src/__phutil_library_map__.php
··· 718 718 'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php', 719 719 'ManiphestTaskExtensions' => 'applications/maniphest/extensions/ManiphestTaskExtensions.php', 720 720 'ManiphestTaskListController' => 'applications/maniphest/controller/ManiphestTaskListController.php', 721 + 'ManiphestTaskListControllerPro' => 'applications/maniphest/controller/ManiphestTaskListControllerPro.php', 721 722 'ManiphestTaskListView' => 'applications/maniphest/view/ManiphestTaskListView.php', 722 723 'ManiphestTaskMailReceiver' => 'applications/maniphest/mail/ManiphestTaskMailReceiver.php', 723 724 'ManiphestTaskOwner' => 'applications/maniphest/constants/ManiphestTaskOwner.php', ··· 725 726 'ManiphestTaskProject' => 'applications/maniphest/storage/ManiphestTaskProject.php', 726 727 'ManiphestTaskProjectsView' => 'applications/maniphest/view/ManiphestTaskProjectsView.php', 727 728 'ManiphestTaskQuery' => 'applications/maniphest/ManiphestTaskQuery.php', 729 + 'ManiphestTaskSearchEngine' => 'applications/maniphest/query/ManiphestTaskSearchEngine.php', 728 730 'ManiphestTaskStatus' => 'applications/maniphest/constants/ManiphestTaskStatus.php', 729 731 'ManiphestTaskSubscriber' => 'applications/maniphest/storage/ManiphestTaskSubscriber.php', 730 732 'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php', ··· 2786 2788 'ManiphestTaskDetailController' => 'ManiphestController', 2787 2789 'ManiphestTaskEditController' => 'ManiphestController', 2788 2790 'ManiphestTaskListController' => 'ManiphestController', 2791 + 'ManiphestTaskListControllerPro' => 2792 + array( 2793 + 0 => 'ManiphestController', 2794 + 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 2795 + ), 2789 2796 'ManiphestTaskListView' => 'ManiphestView', 2790 2797 'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver', 2791 2798 'ManiphestTaskOwner' => 'ManiphestConstants', ··· 2793 2800 'ManiphestTaskProject' => 'ManiphestDAO', 2794 2801 'ManiphestTaskProjectsView' => 'ManiphestView', 2795 2802 'ManiphestTaskQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 2803 + 'ManiphestTaskSearchEngine' => 'PhabricatorApplicationSearchEngine', 2796 2804 'ManiphestTaskStatus' => 'ManiphestConstants', 2797 2805 'ManiphestTaskSubscriber' => 'ManiphestDAO', 2798 2806 'ManiphestTransaction' =>
+1
src/applications/maniphest/application/PhabricatorApplicationManiphest.php
··· 50 50 '/T(?P<id>[1-9]\d*)' => 'ManiphestTaskDetailController', 51 51 '/maniphest/' => array( 52 52 '' => 'ManiphestTaskListController', 53 + 'query/(?:(?P<queryKey>[^/]+)/)?' => 'ManiphestTaskListControllerPro', 53 54 'view/(?P<view>\w+)/' => 'ManiphestTaskListController', 54 55 'report/(?:(?P<view>\w+)/)?' => 'ManiphestReportController', 55 56 'batch/' => 'ManiphestBatchEditController',
+68
src/applications/maniphest/controller/ManiphestTaskListControllerPro.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskListControllerPro 4 + extends ManiphestController 5 + implements PhabricatorApplicationSearchResultsControllerInterface { 6 + 7 + private $queryKey; 8 + 9 + public function shouldAllowPublic() { 10 + return true; 11 + } 12 + 13 + public function willProcessRequest(array $data) { 14 + $this->queryKey = idx($data, 'queryKey'); 15 + } 16 + 17 + public function processRequest() { 18 + $request = $this->getRequest(); 19 + $controller = id(new PhabricatorApplicationSearchController($request)) 20 + ->setQueryKey($this->queryKey) 21 + ->setSearchEngine(new ManiphestTaskSearchEngine()) 22 + ->setNavigation($this->buildSideNavView()); 23 + 24 + return $this->delegateToController($controller); 25 + } 26 + 27 + public function renderResultsList( 28 + array $tasks, 29 + PhabricatorSavedQuery $query) { 30 + assert_instances_of($tasks, 'ManiphestTask'); 31 + 32 + $viewer = $this->getRequest()->getUser(); 33 + 34 + $list = new PHUIObjectItemListView(); 35 + $list->setUser($viewer); 36 + foreach ($tasks as $task) { 37 + $item = id(new PHUIObjectItemView()) 38 + ->setObjectName('T'.$task->getID()) 39 + ->setHeader($task->getTitle()) 40 + ->setHref('/T'.$task->getID()) 41 + ->setObject($task); 42 + 43 + $list->addItem($item); 44 + } 45 + 46 + return $list; 47 + } 48 + 49 + public function buildSideNavView($for_app = false) { 50 + $user = $this->getRequest()->getUser(); 51 + 52 + $nav = new AphrontSideNavFilterView(); 53 + $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 54 + 55 + if ($for_app) { 56 + $nav->addFilter('create', pht('Create Task')); 57 + } 58 + 59 + id(new ManiphestTaskSearchEngine()) 60 + ->setViewer($user) 61 + ->addNavigationItems($nav->getMenu()); 62 + 63 + $nav->selectFilter(null); 64 + 65 + return $nav; 66 + } 67 + 68 + }
+59
src/applications/maniphest/query/ManiphestTaskSearchEngine.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskSearchEngine 4 + extends PhabricatorApplicationSearchEngine { 5 + 6 + public function buildSavedQueryFromRequest(AphrontRequest $request) { 7 + $saved = new PhabricatorSavedQuery(); 8 + 9 + return $saved; 10 + } 11 + 12 + public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { 13 + $query = id(new ManiphestTaskQuery()); 14 + 15 + 16 + return $query; 17 + } 18 + 19 + public function buildSearchForm( 20 + AphrontFormView $form, 21 + PhabricatorSavedQuery $saved_query) { 22 + 23 + } 24 + 25 + protected function getURI($path) { 26 + return '/maniphest/'.$path; 27 + } 28 + 29 + public function getBuiltinQueryNames() { 30 + $names = array(); 31 + 32 + if ($this->requireViewer()->isLoggedIn()) { 33 + $names['assigned'] = pht('Assigned'); 34 + $names['authored'] = pht('Authored'); 35 + } 36 + 37 + $names['all'] = pht('All Tasks'); 38 + 39 + return $names; 40 + } 41 + 42 + public function buildSavedQueryFromBuiltin($query_key) { 43 + 44 + $query = $this->newSavedQuery(); 45 + $query->setQueryKey($query_key); 46 + 47 + switch ($query_key) { 48 + case 'all': 49 + return $query; 50 + case 'assigned': 51 + return $query; 52 + case 'authored': 53 + return $query; 54 + } 55 + 56 + return parent::buildSavedQueryFromBuiltin($query_key); 57 + } 58 + 59 + }