mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 15:22:41 +01:00
Provide a history controller for Releeph branches
Summary: Ref T3663. Same as D6785, but for branches. No writes to this table yet. Test Plan: Clicked "View History", got a blank but non-broken page. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3663 Differential Revision: https://secure.phabricator.com/D6787
This commit is contained in:
parent
f034fd80db
commit
7a24548a3c
5 changed files with 76 additions and 4 deletions
|
@ -1942,12 +1942,14 @@ phutil_register_library_map(array(
|
||||||
'ReleephBranchCreateController' => 'applications/releeph/controller/branch/ReleephBranchCreateController.php',
|
'ReleephBranchCreateController' => 'applications/releeph/controller/branch/ReleephBranchCreateController.php',
|
||||||
'ReleephBranchEditController' => 'applications/releeph/controller/branch/ReleephBranchEditController.php',
|
'ReleephBranchEditController' => 'applications/releeph/controller/branch/ReleephBranchEditController.php',
|
||||||
'ReleephBranchEditor' => 'applications/releeph/editor/ReleephBranchEditor.php',
|
'ReleephBranchEditor' => 'applications/releeph/editor/ReleephBranchEditor.php',
|
||||||
|
'ReleephBranchHistoryController' => 'applications/releeph/controller/branch/ReleephBranchHistoryController.php',
|
||||||
'ReleephBranchNamePreviewController' => 'applications/releeph/controller/branch/ReleephBranchNamePreviewController.php',
|
'ReleephBranchNamePreviewController' => 'applications/releeph/controller/branch/ReleephBranchNamePreviewController.php',
|
||||||
'ReleephBranchPreviewView' => 'applications/releeph/view/branch/ReleephBranchPreviewView.php',
|
'ReleephBranchPreviewView' => 'applications/releeph/view/branch/ReleephBranchPreviewView.php',
|
||||||
'ReleephBranchQuery' => 'applications/releeph/query/ReleephBranchQuery.php',
|
'ReleephBranchQuery' => 'applications/releeph/query/ReleephBranchQuery.php',
|
||||||
'ReleephBranchSearchEngine' => 'applications/releeph/query/ReleephBranchSearchEngine.php',
|
'ReleephBranchSearchEngine' => 'applications/releeph/query/ReleephBranchSearchEngine.php',
|
||||||
'ReleephBranchTemplate' => 'applications/releeph/view/branch/ReleephBranchTemplate.php',
|
'ReleephBranchTemplate' => 'applications/releeph/view/branch/ReleephBranchTemplate.php',
|
||||||
'ReleephBranchTransaction' => 'applications/releeph/storage/ReleephBranchTransaction.php',
|
'ReleephBranchTransaction' => 'applications/releeph/storage/ReleephBranchTransaction.php',
|
||||||
|
'ReleephBranchTransactionQuery' => 'applications/releeph/query/ReleephBranchTransactionQuery.php',
|
||||||
'ReleephBranchViewController' => 'applications/releeph/controller/branch/ReleephBranchViewController.php',
|
'ReleephBranchViewController' => 'applications/releeph/controller/branch/ReleephBranchViewController.php',
|
||||||
'ReleephCommitFinder' => 'applications/releeph/commitfinder/ReleephCommitFinder.php',
|
'ReleephCommitFinder' => 'applications/releeph/commitfinder/ReleephCommitFinder.php',
|
||||||
'ReleephCommitFinderException' => 'applications/releeph/commitfinder/ReleephCommitFinderException.php',
|
'ReleephCommitFinderException' => 'applications/releeph/commitfinder/ReleephCommitFinderException.php',
|
||||||
|
@ -4122,11 +4124,13 @@ phutil_register_library_map(array(
|
||||||
'ReleephBranchCreateController' => 'ReleephProjectController',
|
'ReleephBranchCreateController' => 'ReleephProjectController',
|
||||||
'ReleephBranchEditController' => 'ReleephProjectController',
|
'ReleephBranchEditController' => 'ReleephProjectController',
|
||||||
'ReleephBranchEditor' => 'PhabricatorEditor',
|
'ReleephBranchEditor' => 'PhabricatorEditor',
|
||||||
|
'ReleephBranchHistoryController' => 'ReleephProjectController',
|
||||||
'ReleephBranchNamePreviewController' => 'ReleephController',
|
'ReleephBranchNamePreviewController' => 'ReleephController',
|
||||||
'ReleephBranchPreviewView' => 'AphrontFormControl',
|
'ReleephBranchPreviewView' => 'AphrontFormControl',
|
||||||
'ReleephBranchQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'ReleephBranchQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'ReleephBranchSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'ReleephBranchSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'ReleephBranchTransaction' => 'PhabricatorApplicationTransaction',
|
'ReleephBranchTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
|
'ReleephBranchTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||||
'ReleephBranchViewController' =>
|
'ReleephBranchViewController' =>
|
||||||
array(
|
array(
|
||||||
0 => 'ReleephProjectController',
|
0 => 'ReleephProjectController',
|
||||||
|
|
|
@ -51,10 +51,10 @@ final class PhabricatorApplicationReleeph extends PhabricatorApplication {
|
||||||
'(?P<action>close|re-open)/(?P<branchID>[1-9]\d*)/' =>
|
'(?P<action>close|re-open)/(?P<branchID>[1-9]\d*)/' =>
|
||||||
'ReleephBranchAccessController',
|
'ReleephBranchAccessController',
|
||||||
'preview/' => 'ReleephBranchNamePreviewController',
|
'preview/' => 'ReleephBranchNamePreviewController',
|
||||||
|
'(?P<branchID>[^/]+)/' => array(
|
||||||
// Left in, just in case the by-name stuff fails!
|
'history/' => 'ReleephBranchHistoryController',
|
||||||
'(?P<branchID>[^/]+)/' =>
|
'(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephBranchViewController',
|
||||||
'ReleephBranchViewController',
|
),
|
||||||
),
|
),
|
||||||
'request/' => array(
|
'request/' => array(
|
||||||
'(?P<requestID>[1-9]\d*)/' => 'ReleephRequestViewController',
|
'(?P<requestID>[1-9]\d*)/' => 'ReleephRequestViewController',
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ReleephBranchHistoryController extends ReleephProjectController {
|
||||||
|
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
public function willProcessRequest(array $data) {
|
||||||
|
$this->id = $data['branchID'];
|
||||||
|
parent::willProcessRequest($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processRequest() {
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
|
$branch = id(new ReleephBranchQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withIDs(array($this->id))
|
||||||
|
->executeOne();
|
||||||
|
if (!$branch) {
|
||||||
|
return new Aphront404Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
$xactions = id(new ReleephBranchTransactionQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withObjectPHIDs(array($branch->getPHID()))
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setObjectPHID($branch->getPHID())
|
||||||
|
->setTransactions($xactions);
|
||||||
|
|
||||||
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
$crumbs->addCrumb(
|
||||||
|
id(new PhabricatorCrumbView())
|
||||||
|
->setName(pht('History')));
|
||||||
|
|
||||||
|
return $this->buildApplicationPage(
|
||||||
|
array(
|
||||||
|
$crumbs,
|
||||||
|
$timeline,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'title' => pht('Branch History'),
|
||||||
|
'device' => true,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -123,6 +123,9 @@ final class ReleephBranchViewController extends ReleephProjectController
|
||||||
$close_uri = $branch->getURI('close/');
|
$close_uri = $branch->getURI('close/');
|
||||||
$reopen_uri = $branch->getURI('re-open/');
|
$reopen_uri = $branch->getURI('re-open/');
|
||||||
|
|
||||||
|
$id = $branch->getID();
|
||||||
|
$history_uri = $this->getApplicationURI("branch/{$id}/history/");
|
||||||
|
|
||||||
$actions->addAction(
|
$actions->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setName(pht('Edit Branch'))
|
->setName(pht('Edit Branch'))
|
||||||
|
@ -151,6 +154,11 @@ final class ReleephBranchViewController extends ReleephProjectController
|
||||||
->setWorkflow(true));
|
->setWorkflow(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$actions->addAction(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setName(pht('View History'))
|
||||||
|
->setHref($history_uri)
|
||||||
|
->setIcon('transcript'));
|
||||||
|
|
||||||
$properties = id(new PhabricatorPropertyListView())
|
$properties = id(new PhabricatorPropertyListView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ReleephBranchTransactionQuery
|
||||||
|
extends PhabricatorApplicationTransactionQuery {
|
||||||
|
|
||||||
|
public function getTemplateApplicationTransaction() {
|
||||||
|
return new ReleephBranchTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue