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

Clean up dead code from old task list

Summary:
Removes a bunch of dead stuff:

- Old side nav with hard-coded filters.
- Old edit/list/delete/update interfaces for those filters.
- Old `buildStandardPageResponse()`.
- Some other junk with no callsites.
- Reduce the number of places where the "Create Task" button is built.

Test Plan: `grep`; used list view, batch editor, reports.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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

+43 -414
-6
src/__phutil_library_map__.php
··· 706 706 'ManiphestReplyHandler' => 'applications/maniphest/mail/ManiphestReplyHandler.php', 707 707 'ManiphestReportController' => 'applications/maniphest/controller/ManiphestReportController.php', 708 708 'ManiphestSavedQuery' => 'applications/maniphest/storage/ManiphestSavedQuery.php', 709 - 'ManiphestSavedQueryDeleteController' => 'applications/maniphest/controller/ManiphestSavedQueryDeleteController.php', 710 - 'ManiphestSavedQueryEditController' => 'applications/maniphest/controller/ManiphestSavedQueryEditController.php', 711 - 'ManiphestSavedQueryListController' => 'applications/maniphest/controller/ManiphestSavedQueryListController.php', 712 709 'ManiphestSearchIndexer' => 'applications/maniphest/search/ManiphestSearchIndexer.php', 713 710 'ManiphestSubpriorityController' => 'applications/maniphest/controller/ManiphestSubpriorityController.php', 714 711 'ManiphestSubscribeController' => 'applications/maniphest/controller/ManiphestSubscribeController.php', ··· 2771 2768 'ManiphestReplyHandler' => 'PhabricatorMailReplyHandler', 2772 2769 'ManiphestReportController' => 'ManiphestController', 2773 2770 'ManiphestSavedQuery' => 'ManiphestDAO', 2774 - 'ManiphestSavedQueryDeleteController' => 'ManiphestController', 2775 - 'ManiphestSavedQueryEditController' => 'ManiphestController', 2776 - 'ManiphestSavedQueryListController' => 'ManiphestController', 2777 2771 'ManiphestSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 2778 2772 'ManiphestSubpriorityController' => 'ManiphestController', 2779 2773 'ManiphestSubscribeController' => 'ManiphestController',
-5
src/applications/maniphest/application/PhabricatorApplicationManiphest.php
··· 68 68 ), 69 69 'export/(?P<key>[^/]+)/' => 'ManiphestExportController', 70 70 'subpriority/' => 'ManiphestSubpriorityController', 71 - 'custom/' => array( 72 - '' => 'ManiphestSavedQueryListController', 73 - 'edit/(?:(?P<id>[1-9]\d*)/)?' => 'ManiphestSavedQueryEditController', 74 - 'delete/(?P<id>[1-9]\d*)/' => 'ManiphestSavedQueryDeleteController', 75 - ), 76 71 'subscribe/(?P<action>add|rem)/(?P<id>[1-9]\d*)/' 77 72 => 'ManiphestSubscribeController', 78 73 ),
+16 -9
src/applications/maniphest/controller/ManiphestBatchEditController.php
··· 36 36 ->setURI('/maniphest/query/?ids='.$task_ids); 37 37 } 38 38 39 - $panel = new AphrontPanelView(); 40 - $panel->setHeader(pht('Maniphest Batch Editor')); 41 - $panel->setNoBackground(); 42 - 43 39 $handle_phids = mpull($tasks, 'getOwnerPHID'); 44 40 $handles = $this->loadViewerHandles($handle_phids); 45 41 ··· 125 121 ->appendChild( 126 122 id(new AphrontFormSubmitControl()) 127 123 ->setValue(pht('Update Tasks')) 128 - ->addCancelButton('/maniphest/', 'Done')); 124 + ->addCancelButton('/maniphest/')); 129 125 130 - $panel->appendChild($form); 126 + $title = pht('Batch Editor'); 131 127 128 + $crumbs = $this->buildApplicationCrumbs(); 129 + $crumbs->addCrumb( 130 + id(new PhabricatorCrumbView()) 131 + ->setName($title)); 132 132 133 - return $this->buildStandardPageResponse( 134 - $panel, 133 + $form_box = id(new PHUIFormBoxView()) 134 + ->setHeaderText(pht('Batch Edit Tasks')) 135 + ->setForm($form); 136 + 137 + return $this->buildApplicationPage( 135 138 array( 136 - 'title' => pht('Batch Editor'), 139 + $crumbs, 140 + $form_box, 141 + ), 142 + array( 143 + 'title' => $title, 137 144 )); 138 145 } 139 146
+24 -68
src/applications/maniphest/controller/ManiphestController.php
··· 1 1 <?php 2 2 3 - /** 4 - * @group maniphest 5 - */ 6 3 abstract class ManiphestController extends PhabricatorController { 7 4 8 - private $defaultQuery; 9 - 10 - public function buildStandardPageResponse($view, array $data) { 11 - $page = $this->buildStandardPageView(); 12 - 13 - $page->setApplicationName(pht('Maniphest')); 14 - $page->setBaseURI('/maniphest/'); 15 - $page->setTitle(idx($data, 'title')); 16 - $page->setGlyph("\xE2\x9A\x93"); 17 - $page->appendPageObjects(idx($data, 'pageObjects', array())); 18 - $page->appendChild($view); 19 - $page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_OPEN_TASKS); 20 - 21 - $response = new AphrontWebpageResponse(); 22 - return $response->setContent($page->render()); 5 + public function buildApplicationMenu() { 6 + return $this->buildSideNavView(true)->getMenu(); 23 7 } 24 8 25 - protected function buildBaseSideNav($filter = null, $for_app = false) { 26 - $nav = new AphrontSideNavFilterView(); 27 - $nav->setBaseURI(new PhutilURI('/maniphest/view/')); 28 - 29 - $request = $this->getRequest(); 30 - $user = $request->getUser(); 31 - 32 - $custom = id(new ManiphestSavedQuery())->loadAllWhere( 33 - 'userPHID = %s ORDER BY isDefault DESC, name ASC', 34 - $user->getPHID()); 9 + public function buildSideNavView($for_app = false) { 10 + $user = $this->getRequest()->getUser(); 35 11 36 - // TODO: Enforce uniqueness. Currently, it's possible to save the same 37 - // query under multiple names, and then SideNavFilterView explodes on 38 - // duplicate keys. Generally, we should clean up the custom/saved query 39 - // code as it's a bit of a mess. 40 - $custom = mpull($custom, null, 'getQueryKey'); 41 - 42 - if ($custom) { 43 - $nav->addLabel('Saved Queries'); 44 - foreach ($custom as $query) { 45 - if ($query->getIsDefault()) { 46 - $this->defaultQuery = $query; 47 - } 48 - $nav->addFilter( 49 - 'Q:'.$query->getQueryKey(), 50 - $query->getName(), 51 - '/maniphest/view/custom/?key='.$query->getQueryKey()); 52 - } 53 - $nav->addFilter('saved', pht('Edit...'), '/maniphest/custom/'); 54 - } 12 + $nav = new AphrontSideNavFilterView(); 13 + $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 55 14 56 15 if ($for_app) { 57 - $nav->addFilter('', pht('Create Task'), 58 - $this->getApplicationURI('task/create/')); 16 + $nav->addFilter('create', pht('Create Task')); 59 17 } 60 18 61 - $nav->addLabel(pht('User Tasks')); 62 - $nav->addFilter('action', pht('Assigned')); 63 - $nav->addFilter('created', pht('Created')); 64 - $nav->addFilter('subscribed', pht('Subscribed')); 65 - $nav->addFilter('triage', pht('Need Triage')); 66 - $nav->addLabel(pht('User Projects')); 67 - $nav->addFilter('projecttriage', pht('Need Triage')); 68 - $nav->addFilter('projectall', pht('All Tasks')); 69 - $nav->addLabel('All Tasks'); 70 - $nav->addFilter('alltriage', pht('Need Triage')); 71 - $nav->addFilter('all', pht('All Tasks')); 72 - $nav->addLabel(pht('Custom')); 73 - $nav->addFilter('custom', pht('Custom Query')); 74 - $nav->addFilter('report', pht('Reports'), '/maniphest/report/'); 19 + id(new ManiphestTaskSearchEngine()) 20 + ->setViewer($user) 21 + ->addNavigationItems($nav->getMenu()); 22 + 23 + $nav->addLabel(pht('Reports')); 24 + $nav->addFilter('reports', pht('Reports'), 'report/'); 25 + 26 + $nav->selectFilter(null); 75 27 76 28 return $nav; 77 29 } 78 30 79 - public function buildApplicationMenu() { 80 - return $this->buildBaseSideNav(null, true)->getMenu(); 81 - } 31 + protected function buildApplicationCrumbs() { 32 + $crumbs = parent::buildApplicationCrumbs(); 33 + 34 + $crumbs->addAction( 35 + id(new PHUIListItemView()) 36 + ->setName(pht('Create Task')) 37 + ->setHref($this->getApplicationURI('task/create/')) 38 + ->setIcon('create')); 82 39 83 - protected function getDefaultQuery() { 84 - return $this->defaultQuery; 40 + return $crumbs; 85 41 } 86 42 87 43 protected function renderSingleTask(ManiphestTask $task) {
+1 -5
src/applications/maniphest/controller/ManiphestReportController.php
··· 28 28 return id(new AphrontRedirectResponse())->setURI($uri); 29 29 } 30 30 31 - 32 - $base_nav = $this->buildBaseSideNav(); 33 - $base_nav->selectFilter('report', 'report'); 34 - 35 31 $nav = new AphrontSideNavFilterView(); 36 32 $nav->setBaseURI(new PhutilURI('/maniphest/report/')); 37 33 $nav->addLabel(pht('Open Tasks')); ··· 63 59 id(new PhabricatorCrumbView()) 64 60 ->setName(pht('Reports')))); 65 61 66 - return $this->buildStandardPageResponse( 62 + return $this->buildApplicationPage( 67 63 $nav, 68 64 array( 69 65 'title' => pht('Maniphest Reports'),
-48
src/applications/maniphest/controller/ManiphestSavedQueryDeleteController.php
··· 1 - <?php 2 - 3 - /** 4 - * @group maniphest 5 - */ 6 - final class ManiphestSavedQueryDeleteController extends ManiphestController { 7 - 8 - private $id; 9 - 10 - public function willProcessRequest(array $data) { 11 - $this->id = $data['id']; 12 - } 13 - 14 - public function processRequest() { 15 - $request = $this->getRequest(); 16 - $user = $request->getUser(); 17 - 18 - $id = $this->id; 19 - $query = id(new ManiphestSavedQuery())->load($id); 20 - if (!$query) { 21 - return new Aphront404Response(); 22 - } 23 - if ($query->getUserPHID() != $user->getPHID()) { 24 - return new Aphront400Response(); 25 - } 26 - 27 - if ($request->isDialogFormPost()) { 28 - $query->delete(); 29 - return id(new AphrontRedirectResponse())->setURI('/maniphest/custom/'); 30 - } 31 - 32 - $name = $query->getName(); 33 - $inst = pht( 34 - 'Really delete the query "%s"? It will be lost forever!', $name); 35 - 36 - $dialog = id(new AphrontDialogView()) 37 - ->setUser($user) 38 - ->setTitle(pht('Really delete this query?')) 39 - ->appendChild(hsprintf( 40 - '<p>%s</p>', 41 - $inst)) 42 - ->addCancelButton('/maniphest/custom/') 43 - ->addSubmitButton(pht('Delete')); 44 - 45 - return id(new AphrontDialogResponse())->setDialog($dialog); 46 - } 47 - 48 - }
-105
src/applications/maniphest/controller/ManiphestSavedQueryEditController.php
··· 1 - <?php 2 - 3 - /** 4 - * @group maniphest 5 - */ 6 - final class ManiphestSavedQueryEditController extends ManiphestController { 7 - 8 - private $id; 9 - 10 - public function willProcessRequest(array $data) { 11 - $this->id = idx($data, 'id'); 12 - } 13 - 14 - public function processRequest() { 15 - $request = $this->getRequest(); 16 - $user = $request->getUser(); 17 - 18 - $key = $request->getStr('key'); 19 - if (!$key) { 20 - $id = nonempty($this->id, $request->getInt('id')); 21 - if (!$id) { 22 - return new Aphront404Response(); 23 - } 24 - $query = id(new ManiphestSavedQuery())->load($id); 25 - if (!$query) { 26 - return new Aphront404Response(); 27 - } 28 - if ($query->getUserPHID() != $user->getPHID()) { 29 - return new Aphront400Response(); 30 - } 31 - } else { 32 - $query = new ManiphestSavedQuery(); 33 - $query->setUserPHID($user->getPHID()); 34 - $query->setQueryKey($key); 35 - $query->setIsDefault(0); 36 - } 37 - 38 - $e_name = true; 39 - $errors = array(); 40 - 41 - if ($request->isFormPost()) { 42 - $e_name = null; 43 - $query->setName($request->getStr('name')); 44 - if (!strlen($query->getName())) { 45 - $e_name = pht('Required'); 46 - $errors[] = pht('Saved query name is required.'); 47 - } 48 - 49 - if (!$errors) { 50 - $query->save(); 51 - return id(new AphrontRedirectResponse())->setURI('/maniphest/custom/'); 52 - } 53 - } 54 - 55 - if ($errors) { 56 - $error_view = new AphrontErrorView(); 57 - $error_view->setTitle(pht('Form Errors')); 58 - $error_view->setErrors($errors); 59 - } else { 60 - $error_view = null; 61 - } 62 - 63 - if ($query->getID()) { 64 - $header = pht('Edit Saved Query'); 65 - $cancel_uri = '/maniphest/custom/'; 66 - } else { 67 - $header = pht('New Saved Query'); 68 - $cancel_uri = '/maniphest/view/custom/?key='.$key; 69 - } 70 - 71 - $form = id(new AphrontFormView()) 72 - ->setUser($user) 73 - ->addHiddenInput('key', $key) 74 - ->addHiddenInput('id', $query->getID()) 75 - ->appendChild( 76 - id(new AphrontFormTextControl()) 77 - ->setLabel(pht('Name')) 78 - ->setValue($query->getName()) 79 - ->setName('name') 80 - ->setError($e_name)) 81 - ->appendChild( 82 - id(new AphrontFormSubmitControl()) 83 - ->addCancelButton($cancel_uri) 84 - ->setValue(pht('Save'))); 85 - 86 - $panel = new AphrontPanelView(); 87 - $panel->setHeader($header); 88 - $panel->appendChild($form); 89 - $panel->setWidth(AphrontPanelView::WIDTH_FORM); 90 - 91 - $nav = $this->buildBaseSideNav(); 92 - // The side nav won't show "Saved Queries..." until you have at least one. 93 - $nav->selectFilter('saved', 'custom'); 94 - $nav->appendChild($error_view); 95 - $nav->appendChild($panel); 96 - 97 - return $this->buildApplicationPage( 98 - $nav, 99 - array( 100 - 'title' => pht('Saved Queries'), 101 - 'device' => true, 102 - )); 103 - } 104 - 105 - }
-133
src/applications/maniphest/controller/ManiphestSavedQueryListController.php
··· 1 - <?php 2 - 3 - /** 4 - * @group maniphest 5 - */ 6 - final class ManiphestSavedQueryListController extends ManiphestController { 7 - 8 - public function processRequest() { 9 - $request = $this->getRequest(); 10 - $user = $request->getUser(); 11 - $nav = $this->buildBaseSideNav(); 12 - 13 - $queries = id(new ManiphestSavedQuery())->loadAllWhere( 14 - 'userPHID = %s ORDER BY name ASC', 15 - $user->getPHID()); 16 - 17 - $default = null; 18 - 19 - if ($request->isFormPost()) { 20 - $new_default = null; 21 - foreach ($queries as $query) { 22 - if ($query->getID() == $request->getInt('default')) { 23 - $new_default = $query; 24 - } 25 - } 26 - 27 - if ($this->getDefaultQuery()) { 28 - $this->getDefaultQuery()->setIsDefault(0)->save(); 29 - } 30 - if ($new_default) { 31 - $new_default->setIsDefault(1)->save(); 32 - } 33 - 34 - return id(new AphrontRedirectResponse())->setURI('/maniphest/custom/'); 35 - } 36 - 37 - $rows = array(); 38 - foreach ($queries as $query) { 39 - if ($query->getIsDefault()) { 40 - $default = $query; 41 - } 42 - $rows[] = array( 43 - phutil_tag( 44 - 'input', 45 - array( 46 - 'type' => 'radio', 47 - 'name' => 'default', 48 - 'value' => $query->getID(), 49 - 'checked' => ($query->getIsDefault() ? 'checked' : null), 50 - )), 51 - phutil_tag( 52 - 'a', 53 - array( 54 - 'href' => '/maniphest/view/custom/?key='.$query->getQueryKey(), 55 - ), 56 - $query->getName()), 57 - phutil_tag( 58 - 'a', 59 - array( 60 - 'href' => '/maniphest/custom/edit/'.$query->getID().'/', 61 - 'class' => 'grey small button', 62 - ), 63 - 'Edit'), 64 - javelin_tag( 65 - 'a', 66 - array( 67 - 'href' => '/maniphest/custom/delete/'.$query->getID().'/', 68 - 'class' => 'grey small button', 69 - 'sigil' => 'workflow', 70 - ), 71 - 'Delete'), 72 - ); 73 - } 74 - 75 - $rows[] = array( 76 - phutil_tag( 77 - 'input', 78 - array( 79 - 'type' => 'radio', 80 - 'name' => 'default', 81 - 'value' => 0, 82 - 'checked' => ($default === null ? 'checked' : null), 83 - )), 84 - phutil_tag('em', array(), pht('No Default')), 85 - '', 86 - '', 87 - ); 88 - 89 - $table = new AphrontTableView($rows); 90 - $table->setHeaders( 91 - array( 92 - pht('Default'), 93 - pht('Name'), 94 - pht('Edit'), 95 - pht('Delete'), 96 - )); 97 - $table->setColumnClasses( 98 - array( 99 - 'radio', 100 - 'wide pri', 101 - 'action', 102 - 'action', 103 - )); 104 - 105 - $panel = new AphrontPanelView(); 106 - $panel->setHeader(pht('Saved Custom Queries')); 107 - $panel->addButton( 108 - phutil_tag( 109 - 'button', 110 - array(), 111 - pht('Save Default Query'))); 112 - $panel->appendChild($table); 113 - 114 - $form = phabricator_form( 115 - $user, 116 - array( 117 - 'method' => 'POST', 118 - 'action' => $request->getRequestURI(), 119 - ), 120 - $panel->render()); 121 - 122 - $nav->selectFilter('saved', 'saved'); 123 - $nav->appendChild($form); 124 - 125 - return $this->buildApplicationPage( 126 - $nav, 127 - array( 128 - 'title' => pht('Saved Queries'), 129 - 'device' => true, 130 - )); 131 - } 132 - 133 - }
+1 -6
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 337 337 id(new PhabricatorCrumbView()) 338 338 ->setName($object_name) 339 339 ->setHref('/'.$object_name)) 340 - ->setActionList($actions) 341 - ->addAction( 342 - id(new PHUIListItemView()) 343 - ->setHref($this->getApplicationURI('/task/create/')) 344 - ->setName(pht('Create Task')) 345 - ->setIcon('create')); 340 + ->setActionList($actions); 346 341 347 342 $header = $this->buildHeaderView($task); 348 343 $properties = $this->buildPropertyView($task, $aux_fields, $edges, $engine);
+1 -7
src/applications/maniphest/controller/ManiphestTaskEditController.php
··· 554 554 $crumbs = $this->buildApplicationCrumbs(); 555 555 $crumbs->addCrumb( 556 556 id(new PhabricatorCrumbView()) 557 - ->setName($header_name) 558 - ->setHref($this->getApplicationURI('/task/create/'))) 559 - ->addAction( 560 - id(new PHUIListItemView()) 561 - ->setHref($this->getApplicationURI('/task/create/')) 562 - ->setName(pht('Create Task')) 563 - ->setIcon('create')); 557 + ->setName($header_name)); 564 558 565 559 return $this->buildApplicationPage( 566 560 array(
-22
src/applications/maniphest/controller/ManiphestTaskListController.php
··· 181 181 } 182 182 } 183 183 184 - public function buildSideNavView($for_app = false) { 185 - $user = $this->getRequest()->getUser(); 186 - 187 - $nav = new AphrontSideNavFilterView(); 188 - $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 189 - 190 - if ($for_app) { 191 - $nav->addFilter('create', pht('Create Task')); 192 - } 193 - 194 - id(new ManiphestTaskSearchEngine()) 195 - ->setViewer($user) 196 - ->addNavigationItems($nav->getMenu()); 197 - 198 - $nav->addLabel(pht('Reports')); 199 - $nav->addFilter('reports', pht('Reports'), 'report/'); 200 - 201 - $nav->selectFilter(null); 202 - 203 - return $nav; 204 - } 205 - 206 184 private function renderBatchEditor(PhabricatorSavedQuery $saved_query) { 207 185 $user = $this->getRequest()->getUser(); 208 186