Page MenuHomePhabricator

D8635.id20497.diff
No OneTemporary

D8635.id20497.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2518,16 +2518,16 @@
'ReleephProductController' => 'applications/releeph/controller/project/ReleephProductController.php',
'ReleephProductEditor' => 'applications/releeph/editor/ReleephProductEditor.php',
'ReleephProductHistoryController' => 'applications/releeph/controller/project/ReleephProductHistoryController.php',
+ 'ReleephProductListController' => 'applications/releeph/controller/project/ReleephProductListController.php',
+ 'ReleephProductSearchEngine' => 'applications/releeph/query/ReleephProductSearchEngine.php',
'ReleephProductTransaction' => 'applications/releeph/storage/ReleephProductTransaction.php',
'ReleephProductTransactionQuery' => 'applications/releeph/query/ReleephProductTransactionQuery.php',
+ 'ReleephProductViewController' => 'applications/releeph/controller/project/ReleephProductViewController.php',
'ReleephProject' => 'applications/releeph/storage/ReleephProject.php',
'ReleephProjectController' => 'applications/releeph/controller/ReleephProjectController.php',
'ReleephProjectCreateController' => 'applications/releeph/controller/project/ReleephProjectCreateController.php',
'ReleephProjectEditController' => 'applications/releeph/controller/project/ReleephProjectEditController.php',
- 'ReleephProjectListController' => 'applications/releeph/controller/project/ReleephProjectListController.php',
'ReleephProjectQuery' => 'applications/releeph/query/ReleephProjectQuery.php',
- 'ReleephProjectSearchEngine' => 'applications/releeph/query/ReleephProjectSearchEngine.php',
- 'ReleephProjectViewController' => 'applications/releeph/controller/project/ReleephProjectViewController.php',
'ReleephReasonFieldSpecification' => 'applications/releeph/field/specification/ReleephReasonFieldSpecification.php',
'ReleephRequest' => 'applications/releeph/storage/ReleephRequest.php',
'ReleephRequestActionController' => 'applications/releeph/controller/request/ReleephRequestActionController.php',
@@ -5493,8 +5493,19 @@
'ReleephProductController' => 'ReleephController',
'ReleephProductEditor' => 'PhabricatorApplicationTransactionEditor',
'ReleephProductHistoryController' => 'ReleephProductController',
+ 'ReleephProductListController' =>
+ array(
+ 0 => 'ReleephController',
+ 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
+ ),
+ 'ReleephProductSearchEngine' => 'PhabricatorApplicationSearchEngine',
'ReleephProductTransaction' => 'PhabricatorApplicationTransaction',
'ReleephProductTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
+ 'ReleephProductViewController' =>
+ array(
+ 0 => 'ReleephProductController',
+ 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
+ ),
'ReleephProject' =>
array(
0 => 'ReleephDAO',
@@ -5503,18 +5514,7 @@
'ReleephProjectController' => 'ReleephController',
'ReleephProjectCreateController' => 'ReleephProjectController',
'ReleephProjectEditController' => 'ReleephProjectController',
- 'ReleephProjectListController' =>
- array(
- 0 => 'ReleephController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
'ReleephProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
- 'ReleephProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
- 'ReleephProjectViewController' =>
- array(
- 0 => 'ReleephProjectController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
'ReleephReasonFieldSpecification' => 'ReleephFieldSpecification',
'ReleephRequest' =>
array(
diff --git a/src/applications/releeph/application/PhabricatorApplicationReleeph.php b/src/applications/releeph/application/PhabricatorApplicationReleeph.php
--- a/src/applications/releeph/application/PhabricatorApplicationReleeph.php
+++ b/src/applications/releeph/application/PhabricatorApplicationReleeph.php
@@ -33,12 +33,12 @@
return array(
'/RQ(?P<requestID>[1-9]\d*)' => 'ReleephRequestViewController',
'/releeph/' => array(
- '' => 'ReleephProjectListController',
+ '' => 'ReleephProductListController',
'project/' => array(
- '(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephProjectListController',
+ '(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephProductListController',
'create/' => 'ReleephProjectCreateController',
'(?P<projectID>[1-9]\d*)/' => array(
- '(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephProjectViewController',
+ '(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephProductViewController',
'edit/' => 'ReleephProjectEditController',
'cutbranch/' => 'ReleephBranchCreateController',
'action/(?P<action>.+)/' => 'ReleephProductActionController',
diff --git a/src/applications/releeph/controller/ReleephController.php b/src/applications/releeph/controller/ReleephController.php
--- a/src/applications/releeph/controller/ReleephController.php
+++ b/src/applications/releeph/controller/ReleephController.php
@@ -22,10 +22,10 @@
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
if ($for_app) {
- $nav->addFilter('project/create/', pht('Create Project'));
+ $nav->addFilter('project/create/', pht('Create Product'));
}
- id(new ReleephProjectSearchEngine())
+ id(new ReleephProductSearchEngine())
->setViewer($user)
->addNavigationItems($nav->getMenu());
diff --git a/src/applications/releeph/controller/project/ReleephProductController.php b/src/applications/releeph/controller/project/ReleephProductController.php
--- a/src/applications/releeph/controller/project/ReleephProductController.php
+++ b/src/applications/releeph/controller/project/ReleephProductController.php
@@ -9,6 +9,10 @@
return $this;
}
+ protected function getProduct() {
+ return $this->product;
+ }
+
protected function getProductViewURI(ReleephProject $product) {
return $this->getApplicationURI('project/'.$product->getID().'/');
}
@@ -16,7 +20,7 @@
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
- $product = $this->product;
+ $product = $this->getProduct();
if ($product) {
$crumbs->addTextCrumb(
$product->getName(),
diff --git a/src/applications/releeph/controller/project/ReleephProjectListController.php b/src/applications/releeph/controller/project/ReleephProductListController.php
rename from src/applications/releeph/controller/project/ReleephProjectListController.php
rename to src/applications/releeph/controller/project/ReleephProductListController.php
--- a/src/applications/releeph/controller/project/ReleephProjectListController.php
+++ b/src/applications/releeph/controller/project/ReleephProductListController.php
@@ -1,6 +1,6 @@
<?php
-final class ReleephProjectListController extends ReleephController
+final class ReleephProductListController extends ReleephController
implements PhabricatorApplicationSearchResultsControllerInterface {
private $queryKey;
@@ -17,34 +17,34 @@
$request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey)
- ->setSearchEngine(new ReleephProjectSearchEngine())
+ ->setSearchEngine(new ReleephProductSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
}
public function renderResultsList(
- array $projects,
+ array $products,
PhabricatorSavedQuery $query) {
- assert_instances_of($projects, 'ReleephProject');
+ assert_instances_of($products, 'ReleephProject');
$viewer = $this->getRequest()->getUser();
$list = id(new PHUIObjectItemListView())
->setUser($viewer);
- foreach ($projects as $project) {
- $id = $project->getID();
+ foreach ($products as $product) {
+ $id = $product->getID();
$item = id(new PHUIObjectItemView())
- ->setHeader($project->getName())
+ ->setHeader($product->getName())
->setHref($this->getApplicationURI("project/{$id}/"));
- if (!$project->getIsActive()) {
+ if (!$product->getIsActive()) {
$item->setDisabled(true);
$item->addIcon('none', pht('Inactive'));
}
- $repo = $project->getRepository();
+ $repo = $product->getRepository();
$item->addAttribute(
phutil_tag(
'a',
@@ -53,7 +53,7 @@
),
'r'.$repo->getCallsign()));
- $arc = $project->loadArcanistProject();
+ $arc = $product->loadArcanistProject();
if ($arc) {
$item->addAttribute($arc->getName());
}
@@ -69,7 +69,7 @@
$crumbs->addAction(
id(new PHUIListItemView())
- ->setName(pht('Create Project'))
+ ->setName(pht('Create Product'))
->setHref($this->getApplicationURI('project/create/'))
->setIcon('create'));
diff --git a/src/applications/releeph/controller/project/ReleephProjectViewController.php b/src/applications/releeph/controller/project/ReleephProductViewController.php
rename from src/applications/releeph/controller/project/ReleephProjectViewController.php
rename to src/applications/releeph/controller/project/ReleephProductViewController.php
--- a/src/applications/releeph/controller/project/ReleephProjectViewController.php
+++ b/src/applications/releeph/controller/project/ReleephProductViewController.php
@@ -1,8 +1,9 @@
<?php
-final class ReleephProjectViewController extends ReleephProjectController
+final class ReleephProductViewController extends ReleephProductController
implements PhabricatorApplicationSearchResultsControllerInterface {
+ private $productID;
private $queryKey;
public function shouldAllowPublic() {
@@ -10,18 +11,29 @@
}
public function willProcessRequest(array $data) {
- parent::willProcessRequest($data);
+ $this->productID = idx($data, 'projectID');
$this->queryKey = idx($data, 'queryKey');
}
public function processRequest() {
$request = $this->getRequest();
+ $viewer = $request->getUser();
+
+ $product = id(new ReleephProjectQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($this->productID))
+ ->executeOne();
+ if (!$product) {
+ return new Aphront404Response();
+ }
+ $this->setProduct($product);
+
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey)
->setPreface($this->renderPreface())
->setSearchEngine(
id(new ReleephBranchSearchEngine())
- ->setProjectID($this->getReleephProject()->getID()))
+ ->setProjectID($product->getID()))
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
@@ -34,8 +46,8 @@
$viewer = $this->getRequest()->getUser();
- $projects = mpull($branches, 'getProject');
- $repo_phids = mpull($projects, 'getRepositoryPHID');
+ $products = mpull($branches, 'getProject');
+ $repo_phids = mpull($products, 'getRepositoryPHID');
$repos = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
@@ -116,18 +128,19 @@
}
public function buildSideNavView($for_app = false) {
- $user = $this->getRequest()->getUser();
+ $viewer = $this->getRequest()->getUser();
+ $product = $this->getProduct();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
if ($for_app) {
- $nav->addFilter('project/create/', pht('Create Project'));
+ $nav->addFilter('project/create/', pht('Create Product'));
}
id(new ReleephBranchSearchEngine())
- ->setProjectID($this->getReleephProject()->getID())
- ->setViewer($user)
+ ->setProjectID($product->getID())
+ ->setViewer($viewer)
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
@@ -138,42 +151,43 @@
public function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
- $project = $this->getReleephProject();
-
- $crumbs->addAction(
- id(new PHUIListItemView())
- ->setHref($project->getURI('cutbranch'))
- ->setName(pht('Cut New Branch'))
- ->setIcon('create'));
+ $product = $this->getProduct();
+ if ($product) {
+ $crumbs->addAction(
+ id(new PHUIListItemView())
+ ->setHref($product->getURI('cutbranch/'))
+ ->setName(pht('Cut New Branch'))
+ ->setIcon('create'));
+ }
return $crumbs;
}
private function renderPreface() {
- $project = $this->getReleephProject();
$viewer = $this->getRequest()->getUser();
+ $product = $this->getProduct();
- $id = $project->getID();
+ $id = $product->getID();
$header = id(new PHUIHeaderView())
- ->setHeader($project->getName());
-
- if (!$project->getIsActive()) {
- $header->addTag(
- id(new PHUITagView())
- ->setType(PHUITagView::TYPE_STATE)
- ->setBackgroundColor(PHUITagView::COLOR_BLACK)
- ->setName(pht('Deactivated')));
+ ->setHeader($product->getName())
+ ->setUser($viewer)
+ ->setPolicyObject($product);
+
+ if ($product->getIsActive()) {
+ $header->setStatus('oh-ok', '', pht('Active'));
+ } else {
+ $header->setStatus('policy-noone', '', pht('Inactive'));
}
$actions = id(new PhabricatorActionListView())
->setUser($viewer)
- ->setObject($project)
+ ->setObject($product)
->setObjectURI($this->getRequest()->getRequestURI());
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
- $project,
+ $product,
PhabricatorPolicyCapability::CAN_EDIT);
$edit_uri = $this->getApplicationURI("project/{$id}/edit/");
@@ -181,13 +195,13 @@
$actions->addAction(
id(new PhabricatorActionView())
- ->setName(pht('Edit Project'))
+ ->setName(pht('Edit Product'))
->setHref($edit_uri)
->setIcon('edit')
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
- if ($project->getIsActive()) {
+ if ($product->getIsActive()) {
$status_name = pht('Deactivate Product');
$status_href = "project/{$id}/action/deactivate/";
$status_icon = 'delete';
@@ -213,15 +227,15 @@
$properties = id(new PHUIPropertyListView())
->setUser($viewer)
- ->setObject($project);
+ ->setObject($product);
$properties->addProperty(
pht('Repository'),
- $project->getRepository()->getName());
+ $product->getRepository()->getName());
$properties->setActionList($actions);
- $pushers = $project->getPushers();
+ $pushers = $product->getPushers();
if ($pushers) {
$this->loadHandles($pushers);
$properties->addProperty(
diff --git a/src/applications/releeph/query/ReleephProjectSearchEngine.php b/src/applications/releeph/query/ReleephProductSearchEngine.php
rename from src/applications/releeph/query/ReleephProjectSearchEngine.php
rename to src/applications/releeph/query/ReleephProductSearchEngine.php
--- a/src/applications/releeph/query/ReleephProjectSearchEngine.php
+++ b/src/applications/releeph/query/ReleephProductSearchEngine.php
@@ -1,6 +1,6 @@
<?php
-final class ReleephProjectSearchEngine
+final class ReleephProductSearchEngine
extends PhabricatorApplicationSearchEngine {
public function buildSavedQueryFromRequest(AphrontRequest $request) {
@@ -31,7 +31,7 @@
$form->appendChild(
id(new AphrontFormSelectControl())
->setName('active')
- ->setLabel(pht('Show Projects'))
+ ->setLabel(pht('Show Products'))
->setValue($saved_query->getParameter('active'))
->setOptions($this->getActiveOptions()));
@@ -68,9 +68,9 @@
private function getActiveOptions() {
return array(
- 'all' => pht('Active and Inactive Projects'),
- 'active' => pht('Active Projects'),
- 'inactive' => pht('Inactive Projects'),
+ 'all' => pht('Active and Inactive Products'),
+ 'active' => pht('Active Prodcuts'),
+ 'inactive' => pht('Inactive Products'),
);
}

File Metadata

Mime Type
text/plain
Expires
May 11 2024, 1:12 PM (7 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6286062
Default Alt Text
D8635.id20497.diff (16 KB)

Event Timeline