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

Rename more project -> product in Releeph

Summary:
Ref T3549.

- Renames most "project" in view/list controllers.
- Moves away from "ProjectController".
- Modernizes some modern UI.

Test Plan:
- Viewed product lists.
- Viewed product detail pages.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T3549

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

+86 -68
+14 -14
src/__phutil_library_map__.php
··· 2518 2518 'ReleephProductController' => 'applications/releeph/controller/project/ReleephProductController.php', 2519 2519 'ReleephProductEditor' => 'applications/releeph/editor/ReleephProductEditor.php', 2520 2520 'ReleephProductHistoryController' => 'applications/releeph/controller/project/ReleephProductHistoryController.php', 2521 + 'ReleephProductListController' => 'applications/releeph/controller/project/ReleephProductListController.php', 2522 + 'ReleephProductSearchEngine' => 'applications/releeph/query/ReleephProductSearchEngine.php', 2521 2523 'ReleephProductTransaction' => 'applications/releeph/storage/ReleephProductTransaction.php', 2522 2524 'ReleephProductTransactionQuery' => 'applications/releeph/query/ReleephProductTransactionQuery.php', 2525 + 'ReleephProductViewController' => 'applications/releeph/controller/project/ReleephProductViewController.php', 2523 2526 'ReleephProject' => 'applications/releeph/storage/ReleephProject.php', 2524 2527 'ReleephProjectController' => 'applications/releeph/controller/ReleephProjectController.php', 2525 2528 'ReleephProjectCreateController' => 'applications/releeph/controller/project/ReleephProjectCreateController.php', 2526 2529 'ReleephProjectEditController' => 'applications/releeph/controller/project/ReleephProjectEditController.php', 2527 - 'ReleephProjectListController' => 'applications/releeph/controller/project/ReleephProjectListController.php', 2528 2530 'ReleephProjectQuery' => 'applications/releeph/query/ReleephProjectQuery.php', 2529 - 'ReleephProjectSearchEngine' => 'applications/releeph/query/ReleephProjectSearchEngine.php', 2530 - 'ReleephProjectViewController' => 'applications/releeph/controller/project/ReleephProjectViewController.php', 2531 2531 'ReleephReasonFieldSpecification' => 'applications/releeph/field/specification/ReleephReasonFieldSpecification.php', 2532 2532 'ReleephRequest' => 'applications/releeph/storage/ReleephRequest.php', 2533 2533 'ReleephRequestActionController' => 'applications/releeph/controller/request/ReleephRequestActionController.php', ··· 5493 5493 'ReleephProductController' => 'ReleephController', 5494 5494 'ReleephProductEditor' => 'PhabricatorApplicationTransactionEditor', 5495 5495 'ReleephProductHistoryController' => 'ReleephProductController', 5496 + 'ReleephProductListController' => 5497 + array( 5498 + 0 => 'ReleephController', 5499 + 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 5500 + ), 5501 + 'ReleephProductSearchEngine' => 'PhabricatorApplicationSearchEngine', 5496 5502 'ReleephProductTransaction' => 'PhabricatorApplicationTransaction', 5497 5503 'ReleephProductTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 5504 + 'ReleephProductViewController' => 5505 + array( 5506 + 0 => 'ReleephProductController', 5507 + 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 5508 + ), 5498 5509 'ReleephProject' => 5499 5510 array( 5500 5511 0 => 'ReleephDAO', ··· 5503 5514 'ReleephProjectController' => 'ReleephController', 5504 5515 'ReleephProjectCreateController' => 'ReleephProjectController', 5505 5516 'ReleephProjectEditController' => 'ReleephProjectController', 5506 - 'ReleephProjectListController' => 5507 - array( 5508 - 0 => 'ReleephController', 5509 - 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 5510 - ), 5511 5517 'ReleephProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 5512 - 'ReleephProjectSearchEngine' => 'PhabricatorApplicationSearchEngine', 5513 - 'ReleephProjectViewController' => 5514 - array( 5515 - 0 => 'ReleephProjectController', 5516 - 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 5517 - ), 5518 5518 'ReleephReasonFieldSpecification' => 'ReleephFieldSpecification', 5519 5519 'ReleephRequest' => 5520 5520 array(
+3 -3
src/applications/releeph/application/PhabricatorApplicationReleeph.php
··· 33 33 return array( 34 34 '/RQ(?P<requestID>[1-9]\d*)' => 'ReleephRequestViewController', 35 35 '/releeph/' => array( 36 - '' => 'ReleephProjectListController', 36 + '' => 'ReleephProductListController', 37 37 'project/' => array( 38 - '(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephProjectListController', 38 + '(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephProductListController', 39 39 'create/' => 'ReleephProjectCreateController', 40 40 '(?P<projectID>[1-9]\d*)/' => array( 41 - '(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephProjectViewController', 41 + '(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephProductViewController', 42 42 'edit/' => 'ReleephProjectEditController', 43 43 'cutbranch/' => 'ReleephBranchCreateController', 44 44 'action/(?P<action>.+)/' => 'ReleephProductActionController',
+2 -2
src/applications/releeph/controller/ReleephController.php
··· 22 22 $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 23 23 24 24 if ($for_app) { 25 - $nav->addFilter('project/create/', pht('Create Project')); 25 + $nav->addFilter('project/create/', pht('Create Product')); 26 26 } 27 27 28 - id(new ReleephProjectSearchEngine()) 28 + id(new ReleephProductSearchEngine()) 29 29 ->setViewer($user) 30 30 ->addNavigationItems($nav->getMenu()); 31 31
+5 -1
src/applications/releeph/controller/project/ReleephProductController.php
··· 9 9 return $this; 10 10 } 11 11 12 + protected function getProduct() { 13 + return $this->product; 14 + } 15 + 12 16 protected function getProductViewURI(ReleephProject $product) { 13 17 return $this->getApplicationURI('project/'.$product->getID().'/'); 14 18 } ··· 16 20 protected function buildApplicationCrumbs() { 17 21 $crumbs = parent::buildApplicationCrumbs(); 18 22 19 - $product = $this->product; 23 + $product = $this->getProduct(); 20 24 if ($product) { 21 25 $crumbs->addTextCrumb( 22 26 $product->getName(),
+11 -11
src/applications/releeph/controller/project/ReleephProjectListController.php src/applications/releeph/controller/project/ReleephProductListController.php
··· 1 1 <?php 2 2 3 - final class ReleephProjectListController extends ReleephController 3 + final class ReleephProductListController extends ReleephController 4 4 implements PhabricatorApplicationSearchResultsControllerInterface { 5 5 6 6 private $queryKey; ··· 17 17 $request = $this->getRequest(); 18 18 $controller = id(new PhabricatorApplicationSearchController($request)) 19 19 ->setQueryKey($this->queryKey) 20 - ->setSearchEngine(new ReleephProjectSearchEngine()) 20 + ->setSearchEngine(new ReleephProductSearchEngine()) 21 21 ->setNavigation($this->buildSideNavView()); 22 22 23 23 return $this->delegateToController($controller); 24 24 } 25 25 26 26 public function renderResultsList( 27 - array $projects, 27 + array $products, 28 28 PhabricatorSavedQuery $query) { 29 - assert_instances_of($projects, 'ReleephProject'); 29 + assert_instances_of($products, 'ReleephProject'); 30 30 $viewer = $this->getRequest()->getUser(); 31 31 32 32 $list = id(new PHUIObjectItemListView()) 33 33 ->setUser($viewer); 34 34 35 - foreach ($projects as $project) { 36 - $id = $project->getID(); 35 + foreach ($products as $product) { 36 + $id = $product->getID(); 37 37 38 38 $item = id(new PHUIObjectItemView()) 39 - ->setHeader($project->getName()) 39 + ->setHeader($product->getName()) 40 40 ->setHref($this->getApplicationURI("project/{$id}/")); 41 41 42 - if (!$project->getIsActive()) { 42 + if (!$product->getIsActive()) { 43 43 $item->setDisabled(true); 44 44 $item->addIcon('none', pht('Inactive')); 45 45 } 46 46 47 - $repo = $project->getRepository(); 47 + $repo = $product->getRepository(); 48 48 $item->addAttribute( 49 49 phutil_tag( 50 50 'a', ··· 53 53 ), 54 54 'r'.$repo->getCallsign())); 55 55 56 - $arc = $project->loadArcanistProject(); 56 + $arc = $product->loadArcanistProject(); 57 57 if ($arc) { 58 58 $item->addAttribute($arc->getName()); 59 59 } ··· 69 69 70 70 $crumbs->addAction( 71 71 id(new PHUIListItemView()) 72 - ->setName(pht('Create Project')) 72 + ->setName(pht('Create Product')) 73 73 ->setHref($this->getApplicationURI('project/create/')) 74 74 ->setIcon('create')); 75 75
+46 -32
src/applications/releeph/controller/project/ReleephProjectViewController.php src/applications/releeph/controller/project/ReleephProductViewController.php
··· 1 1 <?php 2 2 3 - final class ReleephProjectViewController extends ReleephProjectController 3 + final class ReleephProductViewController extends ReleephProductController 4 4 implements PhabricatorApplicationSearchResultsControllerInterface { 5 5 6 + private $productID; 6 7 private $queryKey; 7 8 8 9 public function shouldAllowPublic() { ··· 10 11 } 11 12 12 13 public function willProcessRequest(array $data) { 13 - parent::willProcessRequest($data); 14 + $this->productID = idx($data, 'projectID'); 14 15 $this->queryKey = idx($data, 'queryKey'); 15 16 } 16 17 17 18 public function processRequest() { 18 19 $request = $this->getRequest(); 20 + $viewer = $request->getUser(); 21 + 22 + $product = id(new ReleephProjectQuery()) 23 + ->setViewer($viewer) 24 + ->withIDs(array($this->productID)) 25 + ->executeOne(); 26 + if (!$product) { 27 + return new Aphront404Response(); 28 + } 29 + $this->setProduct($product); 30 + 19 31 $controller = id(new PhabricatorApplicationSearchController($request)) 20 32 ->setQueryKey($this->queryKey) 21 33 ->setPreface($this->renderPreface()) 22 34 ->setSearchEngine( 23 35 id(new ReleephBranchSearchEngine()) 24 - ->setProjectID($this->getReleephProject()->getID())) 36 + ->setProjectID($product->getID())) 25 37 ->setNavigation($this->buildSideNavView()); 26 38 27 39 return $this->delegateToController($controller); ··· 34 46 35 47 $viewer = $this->getRequest()->getUser(); 36 48 37 - $projects = mpull($branches, 'getProject'); 38 - $repo_phids = mpull($projects, 'getRepositoryPHID'); 49 + $products = mpull($branches, 'getProject'); 50 + $repo_phids = mpull($products, 'getRepositoryPHID'); 39 51 40 52 $repos = id(new PhabricatorRepositoryQuery()) 41 53 ->setViewer($viewer) ··· 116 128 } 117 129 118 130 public function buildSideNavView($for_app = false) { 119 - $user = $this->getRequest()->getUser(); 131 + $viewer = $this->getRequest()->getUser(); 132 + $product = $this->getProduct(); 120 133 121 134 $nav = new AphrontSideNavFilterView(); 122 135 $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 123 136 124 137 if ($for_app) { 125 - $nav->addFilter('project/create/', pht('Create Project')); 138 + $nav->addFilter('project/create/', pht('Create Product')); 126 139 } 127 140 128 141 id(new ReleephBranchSearchEngine()) 129 - ->setProjectID($this->getReleephProject()->getID()) 130 - ->setViewer($user) 142 + ->setProjectID($product->getID()) 143 + ->setViewer($viewer) 131 144 ->addNavigationItems($nav->getMenu()); 132 145 133 146 $nav->selectFilter(null); ··· 138 151 public function buildApplicationCrumbs() { 139 152 $crumbs = parent::buildApplicationCrumbs(); 140 153 141 - $project = $this->getReleephProject(); 142 - 143 - $crumbs->addAction( 144 - id(new PHUIListItemView()) 145 - ->setHref($project->getURI('cutbranch')) 146 - ->setName(pht('Cut New Branch')) 147 - ->setIcon('create')); 154 + $product = $this->getProduct(); 155 + if ($product) { 156 + $crumbs->addAction( 157 + id(new PHUIListItemView()) 158 + ->setHref($product->getURI('cutbranch/')) 159 + ->setName(pht('Cut New Branch')) 160 + ->setIcon('create')); 161 + } 148 162 149 163 return $crumbs; 150 164 } 151 165 152 166 private function renderPreface() { 153 - $project = $this->getReleephProject(); 154 167 $viewer = $this->getRequest()->getUser(); 168 + $product = $this->getProduct(); 155 169 156 - $id = $project->getID(); 170 + $id = $product->getID(); 157 171 158 172 $header = id(new PHUIHeaderView()) 159 - ->setHeader($project->getName()); 173 + ->setHeader($product->getName()) 174 + ->setUser($viewer) 175 + ->setPolicyObject($product); 160 176 161 - if (!$project->getIsActive()) { 162 - $header->addTag( 163 - id(new PHUITagView()) 164 - ->setType(PHUITagView::TYPE_STATE) 165 - ->setBackgroundColor(PHUITagView::COLOR_BLACK) 166 - ->setName(pht('Deactivated'))); 177 + if ($product->getIsActive()) { 178 + $header->setStatus('oh-ok', '', pht('Active')); 179 + } else { 180 + $header->setStatus('policy-noone', '', pht('Inactive')); 167 181 } 168 182 169 183 $actions = id(new PhabricatorActionListView()) 170 184 ->setUser($viewer) 171 - ->setObject($project) 185 + ->setObject($product) 172 186 ->setObjectURI($this->getRequest()->getRequestURI()); 173 187 174 188 $can_edit = PhabricatorPolicyFilter::hasCapability( 175 189 $viewer, 176 - $project, 190 + $product, 177 191 PhabricatorPolicyCapability::CAN_EDIT); 178 192 179 193 $edit_uri = $this->getApplicationURI("project/{$id}/edit/"); ··· 181 195 182 196 $actions->addAction( 183 197 id(new PhabricatorActionView()) 184 - ->setName(pht('Edit Project')) 198 + ->setName(pht('Edit Product')) 185 199 ->setHref($edit_uri) 186 200 ->setIcon('edit') 187 201 ->setDisabled(!$can_edit) 188 202 ->setWorkflow(!$can_edit)); 189 203 190 - if ($project->getIsActive()) { 204 + if ($product->getIsActive()) { 191 205 $status_name = pht('Deactivate Product'); 192 206 $status_href = "project/{$id}/action/deactivate/"; 193 207 $status_icon = 'delete'; ··· 213 227 214 228 $properties = id(new PHUIPropertyListView()) 215 229 ->setUser($viewer) 216 - ->setObject($project); 230 + ->setObject($product); 217 231 218 232 $properties->addProperty( 219 233 pht('Repository'), 220 - $project->getRepository()->getName()); 234 + $product->getRepository()->getName()); 221 235 222 236 $properties->setActionList($actions); 223 237 224 - $pushers = $project->getPushers(); 238 + $pushers = $product->getPushers(); 225 239 if ($pushers) { 226 240 $this->loadHandles($pushers); 227 241 $properties->addProperty(
+5 -5
src/applications/releeph/query/ReleephProjectSearchEngine.php src/applications/releeph/query/ReleephProductSearchEngine.php
··· 1 1 <?php 2 2 3 - final class ReleephProjectSearchEngine 3 + final class ReleephProductSearchEngine 4 4 extends PhabricatorApplicationSearchEngine { 5 5 6 6 public function buildSavedQueryFromRequest(AphrontRequest $request) { ··· 31 31 $form->appendChild( 32 32 id(new AphrontFormSelectControl()) 33 33 ->setName('active') 34 - ->setLabel(pht('Show Projects')) 34 + ->setLabel(pht('Show Products')) 35 35 ->setValue($saved_query->getParameter('active')) 36 36 ->setOptions($this->getActiveOptions())); 37 37 ··· 68 68 69 69 private function getActiveOptions() { 70 70 return array( 71 - 'all' => pht('Active and Inactive Projects'), 72 - 'active' => pht('Active Projects'), 73 - 'inactive' => pht('Inactive Projects'), 71 + 'all' => pht('Active and Inactive Products'), 72 + 'active' => pht('Active Prodcuts'), 73 + 'inactive' => pht('Inactive Products'), 74 74 ); 75 75 } 76 76