Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15460260
D14944.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
16 KB
Referenced Files
None
Subscribers
None
D14944.id.diff
View Options
diff --git a/src/applications/diffusion/controller/DiffusionChangeController.php b/src/applications/diffusion/controller/DiffusionChangeController.php
--- a/src/applications/diffusion/controller/DiffusionChangeController.php
+++ b/src/applications/diffusion/controller/DiffusionChangeController.php
@@ -6,9 +6,14 @@
return true;
}
- protected function processDiffusionRequest(AphrontRequest $request) {
- $drequest = $this->diffusionRequest;
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->loadDiffusionContext();
+ if ($response) {
+ return $response;
+ }
+
+ $viewer = $this->getViewer();
+ $drequest = $this->getDiffusionRequest();
$content = array();
@@ -89,15 +94,18 @@
->setHeader($header)
->addPropertyList($properties);
- return $this->buildApplicationPage(
- array(
- $crumbs,
- $object_box,
- $content,
- ),
- array(
- 'title' => pht('Change'),
- ));
+ return $this->newPage()
+ ->setTitle(
+ array(
+ basename($drequest->getPath()),
+ $repository->getDisplayName(),
+ ))
+ ->setCrumbs($crumbs)
+ ->appendChild(
+ array(
+ $object_box,
+ $content,
+ ));
}
private function buildActionView(DiffusionRequest $drequest) {
diff --git a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php
--- a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php
@@ -6,7 +6,12 @@
return true;
}
- protected function processDiffusionRequest(AphrontRequest $request) {
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->loadDiffusionContext();
+ if ($response) {
+ return $response;
+ }
+
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
diff --git a/src/applications/diffusion/controller/DiffusionCommitEditController.php b/src/applications/diffusion/controller/DiffusionCommitEditController.php
--- a/src/applications/diffusion/controller/DiffusionCommitEditController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitEditController.php
@@ -2,18 +2,24 @@
final class DiffusionCommitEditController extends DiffusionController {
- protected function processDiffusionRequest(AphrontRequest $request) {
- $user = $request->getUser();
- $drequest = $this->getDiffusionRequest();
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->loadDiffusionContext();
+ if ($response) {
+ return $response;
+ }
+
+ $viewer = $this->getViewer();
+ $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
- $commit = $drequest->loadCommit();
- $data = $commit->loadCommitData();
- $page_title = pht('Edit Diffusion Commit');
+ $commit = $drequest->loadCommit();
if (!$commit) {
return new Aphront404Response();
}
+ $data = $commit->loadCommitData();
+ $page_title = pht('Edit Diffusion Commit');
+
$commit_phid = $commit->getPHID();
$edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
$current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
@@ -27,18 +33,21 @@
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue('edge:type', $edge_type)
->setNewValue(array('=' => array_fuse($proj_phids)));
+
$editor = id(new PhabricatorAuditEditor())
- ->setActor($user)
+ ->setActor($viewer)
->setContinueOnNoEffect(true)
->setContentSourceFromRequest($request);
- $xactions = $editor->applyTransactions($commit, $xactions);
+
+ $editor->applyTransactions($commit, $xactions);
+
return id(new AphrontRedirectResponse())
->setURI($commit->getURI());
}
$tokenizer_id = celerity_generate_unique_node_id();
$form = id(new AphrontFormView())
- ->setUser($user)
+ ->setUser($viewer)
->setAction($request->getRequestURI()->getPath())
->appendControl(
id(new AphrontFormTokenizerControl())
@@ -87,33 +96,25 @@
->setValue(array($desc, " \xC2\xB7 ", $doc_link)));
}
+ $form->appendControl(
+ id(new AphrontFormSubmitControl())
+ ->setValue(pht('Save'))
+ ->addCancelButton($commit->getURI()));
- Javelin::initBehavior('project-create', array(
- 'tokenizerID' => $tokenizer_id,
- ));
-
- $submit = id(new AphrontFormSubmitControl())
- ->setValue(pht('Save'))
- ->addCancelButton($commit->getURI());
- $form->appendChild($submit);
-
- $crumbs = $this->buildCrumbs(array(
- 'commit' => true,
- ));
+ $crumbs = $this->buildCrumbs(
+ array(
+ 'commit' => true,
+ ));
$crumbs->addTextCrumb(pht('Edit'));
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($page_title)
->setForm($form);
- return $this->buildApplicationPage(
- array(
- $crumbs,
- $form_box,
- ),
- array(
- 'title' => $page_title,
- ));
+ return $this->newPage()
+ ->setTitle($page_title)
+ ->setCrumbs($crumbs)
+ ->appendChild($form_box);
}
}
diff --git a/src/applications/diffusion/controller/DiffusionCommitTagsController.php b/src/applications/diffusion/controller/DiffusionCommitTagsController.php
--- a/src/applications/diffusion/controller/DiffusionCommitTagsController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitTagsController.php
@@ -6,7 +6,12 @@
return true;
}
- protected function processDiffusionRequest(AphrontRequest $request) {
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->loadDiffusionContext();
+ if ($response) {
+ return $response;
+ }
+
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
diff --git a/src/applications/diffusion/controller/DiffusionHistoryController.php b/src/applications/diffusion/controller/DiffusionHistoryController.php
--- a/src/applications/diffusion/controller/DiffusionHistoryController.php
+++ b/src/applications/diffusion/controller/DiffusionHistoryController.php
@@ -6,19 +6,24 @@
return true;
}
- protected function processDiffusionRequest(AphrontRequest $request) {
- $drequest = $this->diffusionRequest;
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->loadDiffusionContext();
+ if ($response) {
+ return $response;
+ }
+
+ $viewer = $this->getViewer();
+ $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
- $page_size = $request->getInt('pagesize', 100);
- $offset = $request->getInt('offset', 0);
+ $pager = id(new PHUIPagerView())
+ ->readFromRequest($request);
$params = array(
'commit' => $drequest->getCommit(),
'path' => $drequest->getPath(),
- 'offset' => $offset,
- 'limit' => $page_size + 1,
+ 'offset' => $pager->getOffset(),
+ 'limit' => $pager->getPageSize() + 1,
);
if (!$request->getBool('copies')) {
@@ -32,13 +37,8 @@
$history = DiffusionPathChange::newFromConduit(
$history_results['pathChanges']);
- $pager = new PHUIPagerView();
- $pager->setPageSize($page_size);
- $pager->setOffset($offset);
$history = $pager->sliceResults($history);
- $pager->setURI($request->getRequestURI(), 'offset');
-
$show_graph = !strlen($drequest->getPath());
$content = array();
@@ -51,7 +51,7 @@
if ($show_graph) {
$history_table->setParents($history_results['parents']);
- $history_table->setIsHead($offset == 0);
+ $history_table->setIsHead(!$pager->getOffset());
}
$history_panel = new PHUIObjectBoxView();
@@ -79,23 +79,21 @@
'view' => 'history',
));
- $pager = id(new PHUIBoxView())
- ->addClass('ml')
- ->appendChild($pager);
+ $pager_box = $this->renderTablePagerBox($pager);
- return $this->buildApplicationPage(
- array(
- $crumbs,
- $object_box,
- $content,
- $pager,
- ),
- array(
- 'title' => array(
+ return $this->newPage()
+ ->setTitle(
+ array(
pht('History'),
- $drequest->getRepository()->getDisplayName(),
- ),
- ));
+ $repository->getDisplayName(),
+ ))
+ ->setCrumbs($crumbs)
+ ->appendChild(
+ array(
+ $object_box,
+ $content,
+ $pager_box,
+ ));
}
private function buildActionView(DiffusionRequest $drequest) {
diff --git a/src/applications/diffusion/controller/DiffusionMirrorDeleteController.php b/src/applications/diffusion/controller/DiffusionMirrorDeleteController.php
--- a/src/applications/diffusion/controller/DiffusionMirrorDeleteController.php
+++ b/src/applications/diffusion/controller/DiffusionMirrorDeleteController.php
@@ -3,9 +3,14 @@
final class DiffusionMirrorDeleteController
extends DiffusionController {
- protected function processDiffusionRequest(AphrontRequest $request) {
- $viewer = $request->getUser();
- $drequest = $this->diffusionRequest;
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->loadDiffusionContext();
+ if ($response) {
+ return $response;
+ }
+
+ $viewer = $this->getViewer();
+ $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$mirror = id(new PhabricatorRepositoryMirrorQuery())
diff --git a/src/applications/diffusion/controller/DiffusionMirrorEditController.php b/src/applications/diffusion/controller/DiffusionMirrorEditController.php
--- a/src/applications/diffusion/controller/DiffusionMirrorEditController.php
+++ b/src/applications/diffusion/controller/DiffusionMirrorEditController.php
@@ -3,9 +3,14 @@
final class DiffusionMirrorEditController
extends DiffusionController {
- protected function processDiffusionRequest(AphrontRequest $request) {
- $viewer = $request->getUser();
- $drequest = $this->diffusionRequest;
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->loadDiffusionContext();
+ if ($response) {
+ return $response;
+ }
+
+ $viewer = $this->getViewer();
+ $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
PhabricatorPolicyFilter::requireCapability(
diff --git a/src/applications/diffusion/controller/DiffusionPushEventViewController.php b/src/applications/diffusion/controller/DiffusionPushEventViewController.php
--- a/src/applications/diffusion/controller/DiffusionPushEventViewController.php
+++ b/src/applications/diffusion/controller/DiffusionPushEventViewController.php
@@ -7,8 +7,8 @@
return true;
}
- protected function processDiffusionRequest(AphrontRequest $request) {
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
$event = id(new PhabricatorRepositoryPushEventQuery())
->setViewer($viewer)
@@ -57,16 +57,15 @@
->setHeaderText(pht('All Pushed Updates'))
->setTable($updates_table);
- return $this->buildApplicationPage(
- array(
- $crumbs,
- $detail_box,
- $commits_box,
- $update_box,
- ),
- array(
- 'title' => $title,
- ));
+ return $this->newPage()
+ ->setTitle($title)
+ ->setCrumbs($crumbs)
+ ->appendChild(
+ array(
+ $detail_box,
+ $commits_box,
+ $update_box,
+ ));
}
private function buildPropertyList(PhabricatorRepositoryPushEvent $event) {
diff --git a/src/applications/diffusion/controller/DiffusionPushLogListController.php b/src/applications/diffusion/controller/DiffusionPushLogListController.php
--- a/src/applications/diffusion/controller/DiffusionPushLogListController.php
+++ b/src/applications/diffusion/controller/DiffusionPushLogListController.php
@@ -6,29 +6,10 @@
return true;
}
- protected function processDiffusionRequest(AphrontRequest $request) {
- $request = $this->getRequest();
- $controller = id(new PhabricatorApplicationSearchController())
- ->setQueryKey($request->getURIData('queryKey'))
- ->setSearchEngine(new PhabricatorRepositoryPushLogSearchEngine())
- ->setNavigation($this->buildSideNavView());
-
- return $this->delegateToController($controller);
- }
-
- public function buildSideNavView($for_app = false) {
- $viewer = $this->getRequest()->getUser();
-
- $nav = new AphrontSideNavFilterView();
- $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
-
- id(new PhabricatorRepositoryPushLogSearchEngine())
- ->setViewer($viewer)
- ->addNavigationItems($nav->getMenu());
-
- $nav->selectFilter(null);
-
- return $nav;
+ public function handleRequest(AphrontRequest $request) {
+ return id(new PhabricatorRepositoryPushLogSearchEngine())
+ ->setController($this)
+ ->buildResponse();
}
}
diff --git a/src/applications/diffusion/controller/DiffusionRefTableController.php b/src/applications/diffusion/controller/DiffusionRefTableController.php
--- a/src/applications/diffusion/controller/DiffusionRefTableController.php
+++ b/src/applications/diffusion/controller/DiffusionRefTableController.php
@@ -6,9 +6,13 @@
return true;
}
- protected function processDiffusionRequest(AphrontRequest $request) {
- $viewer = $this->getViewer();
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->loadDiffusionContext();
+ if ($response) {
+ return $response;
+ }
+ $viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
@@ -132,18 +136,15 @@
$crumbs = $this->buildCrumbs(array());
$crumbs->addTextCrumb(pht('Refs'));
- return $this->buildApplicationPage(
- array(
- $crumbs,
- $content,
- ),
- array(
- 'title' => array(
- pht('Refs'),
- $repository->getMonogram(),
+ return $this->newPage()
+ ->setTitle(
+ array(
$ref_name,
- ),
- ));
+ pht('Ref'),
+ $repository->getDisplayName(),
+ ))
+ ->setCrumbs($crumbs)
+ ->appendChild($content);
}
}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryListController.php b/src/applications/diffusion/controller/DiffusionRepositoryListController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryListController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryListController.php
@@ -6,28 +6,10 @@
return true;
}
- protected function processDiffusionRequest(AphrontRequest $request) {
- $controller = id(new PhabricatorApplicationSearchController())
- ->setQueryKey($request->getURIData('queryKey'))
- ->setSearchEngine(new PhabricatorRepositorySearchEngine())
- ->setNavigation($this->buildSideNavView());
-
- return $this->delegateToController($controller);
- }
-
- public function buildSideNavView($for_app = false) {
- $viewer = $this->getRequest()->getUser();
-
- $nav = new AphrontSideNavFilterView();
- $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
-
- id(new PhabricatorRepositorySearchEngine())
- ->setViewer($viewer)
- ->addNavigationItems($nav->getMenu());
-
- $nav->selectFilter(null);
-
- return $nav;
+ public function handleRequest(AphrontRequest $request) {
+ return id(new PhabricatorRepositorySearchEngine())
+ ->setController($this)
+ ->buildResponse();
}
protected function buildApplicationCrumbs() {
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php b/src/applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php
@@ -3,9 +3,14 @@
final class DiffusionRepositoryTestAutomationController
extends DiffusionRepositoryEditController {
- protected function processDiffusionRequest(AphrontRequest $request) {
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->loadDiffusionContext();
+ if ($response) {
+ return $response;
+ }
+
$viewer = $this->getViewer();
- $drequest = $this->diffusionRequest;
+ $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 1, 9:17 PM (4 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7705980
Default Alt Text
D14944.id.diff (16 KB)
Attached To
Mode
D14944: Modernize more Diffusion controllers
Attached
Detach File
Event Timeline
Log In to Comment