1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +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:
epriestley 2013-08-20 10:11:52 -07:00
parent f034fd80db
commit 7a24548a3c
5 changed files with 76 additions and 4 deletions

View file

@ -1942,12 +1942,14 @@ phutil_register_library_map(array(
'ReleephBranchCreateController' => 'applications/releeph/controller/branch/ReleephBranchCreateController.php',
'ReleephBranchEditController' => 'applications/releeph/controller/branch/ReleephBranchEditController.php',
'ReleephBranchEditor' => 'applications/releeph/editor/ReleephBranchEditor.php',
'ReleephBranchHistoryController' => 'applications/releeph/controller/branch/ReleephBranchHistoryController.php',
'ReleephBranchNamePreviewController' => 'applications/releeph/controller/branch/ReleephBranchNamePreviewController.php',
'ReleephBranchPreviewView' => 'applications/releeph/view/branch/ReleephBranchPreviewView.php',
'ReleephBranchQuery' => 'applications/releeph/query/ReleephBranchQuery.php',
'ReleephBranchSearchEngine' => 'applications/releeph/query/ReleephBranchSearchEngine.php',
'ReleephBranchTemplate' => 'applications/releeph/view/branch/ReleephBranchTemplate.php',
'ReleephBranchTransaction' => 'applications/releeph/storage/ReleephBranchTransaction.php',
'ReleephBranchTransactionQuery' => 'applications/releeph/query/ReleephBranchTransactionQuery.php',
'ReleephBranchViewController' => 'applications/releeph/controller/branch/ReleephBranchViewController.php',
'ReleephCommitFinder' => 'applications/releeph/commitfinder/ReleephCommitFinder.php',
'ReleephCommitFinderException' => 'applications/releeph/commitfinder/ReleephCommitFinderException.php',
@ -4122,11 +4124,13 @@ phutil_register_library_map(array(
'ReleephBranchCreateController' => 'ReleephProjectController',
'ReleephBranchEditController' => 'ReleephProjectController',
'ReleephBranchEditor' => 'PhabricatorEditor',
'ReleephBranchHistoryController' => 'ReleephProjectController',
'ReleephBranchNamePreviewController' => 'ReleephController',
'ReleephBranchPreviewView' => 'AphrontFormControl',
'ReleephBranchQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'ReleephBranchSearchEngine' => 'PhabricatorApplicationSearchEngine',
'ReleephBranchTransaction' => 'PhabricatorApplicationTransaction',
'ReleephBranchTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'ReleephBranchViewController' =>
array(
0 => 'ReleephProjectController',

View file

@ -51,10 +51,10 @@ final class PhabricatorApplicationReleeph extends PhabricatorApplication {
'(?P<action>close|re-open)/(?P<branchID>[1-9]\d*)/' =>
'ReleephBranchAccessController',
'preview/' => 'ReleephBranchNamePreviewController',
// Left in, just in case the by-name stuff fails!
'(?P<branchID>[^/]+)/' =>
'ReleephBranchViewController',
'(?P<branchID>[^/]+)/' => array(
'history/' => 'ReleephBranchHistoryController',
'(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephBranchViewController',
),
),
'request/' => array(
'(?P<requestID>[1-9]\d*)/' => 'ReleephRequestViewController',

View file

@ -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,
));
}
}

View file

@ -123,6 +123,9 @@ final class ReleephBranchViewController extends ReleephProjectController
$close_uri = $branch->getURI('close/');
$reopen_uri = $branch->getURI('re-open/');
$id = $branch->getID();
$history_uri = $this->getApplicationURI("branch/{$id}/history/");
$actions->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Branch'))
@ -151,6 +154,11 @@ final class ReleephBranchViewController extends ReleephProjectController
->setWorkflow(true));
}
$actions->addAction(
id(new PhabricatorActionView())
->setName(pht('View History'))
->setHref($history_uri)
->setIcon('transcript'));
$properties = id(new PhabricatorPropertyListView())
->setUser($viewer)

View file

@ -0,0 +1,10 @@
<?php
final class ReleephBranchTransactionQuery
extends PhabricatorApplicationTransactionQuery {
public function getTemplateApplicationTransaction() {
return new ReleephBranchTransaction();
}
}