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

Remove remnants of clumsy old URI state handling from workboards

Summary:
Depends on D20636. Ref T4900. Previously, some workflows didn't know how to identify the default state for the board, so they needed explicit ("force") parameters.

Everything uses the same state management code now so we can rip out the old stuff.

Test Plan: Changed board filters, selected a custom filter, edited a custom filter.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T4900

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

+22 -46
+19 -43
src/applications/project/controller/PhabricatorProjectBoardViewController.php
··· 495 495 ->setName($name); 496 496 497 497 if ($is_custom) { 498 - $uri = $this->getApplicationURI( 499 - 'board/'.$project->getID().'/filter/query/'.$key.'/'); 498 + // When you're using a custom filter already and you select "Custom 499 + // Filter", you get a dialog back to let you edit the filter. This is 500 + // equivalent to selecting "Advanced Filter..." to configure a new 501 + // filter. 502 + $filter_uri = $state->newWorkboardURI('filter/'); 500 503 $item->setWorkflow(true); 501 504 } else { 502 - $uri = $engine->getQueryResultsPageURI($key); 505 + $filter_uri = urisprintf('query/%s/', $key); 506 + $filter_uri = $state->newWorkboardURI($filter_uri); 507 + $filter_uri->removeQueryParam('filter'); 503 508 } 504 509 505 - $uri = $this->getURIWithState($uri) 506 - ->removeQueryParam('filter'); 507 - $item->setHref($uri); 510 + $item->setHref($filter_uri); 508 511 509 512 $items[] = $item; 510 513 } 511 514 512 515 $id = $project->getID(); 513 516 514 - $filter_uri = $this->getApplicationURI("board/{$id}/filter/"); 515 - $filter_uri = $this->getURIWithState($filter_uri, $force = true); 517 + $filter_uri = $state->newWorkboardURI('filter/'); 516 518 517 519 $items[] = id(new PhabricatorActionView()) 518 520 ->setIcon('fa-cog') ··· 716 718 ->setIcon('fa-search') 717 719 ->setHref($query_uri); 718 720 719 - $column_move_uri = $state->newWorkboardURI( 720 - urisprintf( 721 - 'bulkmove/%d/column/', 722 - $column->getID())); 721 + $column_move_uri = urisprintf('bulkmove/%d/column/', $column->getID()); 722 + $column_move_uri = $state->newWorkboardURI($column_move_uri); 723 723 724 724 $column_items[] = id(new PhabricatorActionView()) 725 725 ->setIcon('fa-arrows-h') ··· 727 727 ->setHref($column_move_uri) 728 728 ->setWorkflow(true); 729 729 730 - $project_move_uri = $state->newWorkboardURI( 731 - urisprintf( 732 - 'bulkmove/%d/project/', 733 - $column->getID())); 730 + $project_move_uri = urisprintf('bulkmove/%d/project/', $column->getID()); 731 + $project_move_uri = $state->newWorkboardURI($project_move_uri); 734 732 735 733 $column_items[] = id(new PhabricatorActionView()) 736 734 ->setIcon('fa-arrows') ··· 738 736 ->setHref($project_move_uri) 739 737 ->setWorkflow(true); 740 738 741 - $bulk_edit_uri = $state->newWorkboardURI( 742 - urisprintf( 743 - 'bulk/%d/', 744 - $column->getID())); 739 + $bulk_edit_uri = urisprintf('bulk/%d/', $column->getID()); 740 + $bulk_edit_uri = $state->newWorkboardURI($bulk_edit_uri); 745 741 746 742 $can_bulk_edit = PhabricatorPolicyFilter::hasCapability( 747 743 $viewer, ··· 767 763 ->setWorkflow(true); 768 764 769 765 $can_hide = ($can_edit && !$column->isDefaultColumn()); 770 - $hide_uri = 'board/'.$project->getID().'/hide/'.$column->getID().'/'; 771 - $hide_uri = $this->getApplicationURI($hide_uri); 772 - $hide_uri = $this->getURIWithState($hide_uri); 766 + 767 + $hide_uri = urisprintf('hide/%d/', $column->getID()); 768 + $hide_uri = $state->newWorkboardURI($hide_uri); 773 769 774 770 if (!$column->isHidden()) { 775 771 $column_items[] = id(new PhabricatorActionView()) ··· 873 869 )); 874 870 875 871 return $trigger_button; 876 - } 877 - 878 - /** 879 - * Add current state parameters (like order and the visibility of hidden 880 - * columns) to a URI. 881 - * 882 - * This allows actions which toggle or adjust one piece of state to keep 883 - * the rest of the board state persistent. If no URI is provided, this method 884 - * starts with the request URI. 885 - * 886 - * @param string|null URI to add state parameters to. 887 - * @param bool True to explicitly include all state. 888 - * @return PhutilURI URI with state parameters. 889 - */ 890 - private function getURIWithState($base = null, $force = false) { 891 - if ($base === null) { 892 - $base = $this->getProject()->getWorkboardURI(); 893 - } 894 - 895 - return $this->getViewState()->newURI($base, $force); 896 872 } 897 873 898 874 private function buildInitializeContent(PhabricatorProject $project) {
+3 -3
src/applications/project/state/PhabricatorWorkboardViewState.php
··· 107 107 return $this->newURI($uri); 108 108 } 109 109 110 - public function newURI($path, $force = false) { 110 + public function newURI($path) { 111 111 $project = $this->getProject(); 112 112 $uri = new PhutilURI($path); 113 113 114 114 $request_order = $this->getOrder(); 115 115 $default_order = $this->getDefaultOrder(); 116 - if ($force || ($request_order !== $default_order)) { 116 + if ($request_order !== $default_order) { 117 117 $request_value = idx($this->requestState, 'order'); 118 118 if ($request_value !== null) { 119 119 $uri->replaceQueryParam('order', $request_value); ··· 126 126 127 127 $request_query = $this->getQueryKey(); 128 128 $default_query = $this->getDefaultQueryKey(); 129 - if ($force || ($request_query !== $default_query)) { 129 + if ($request_query !== $default_query) { 130 130 $request_value = idx($this->requestState, 'filter'); 131 131 if ($request_value !== null) { 132 132 $uri->replaceQueryParam('filter', $request_value);