1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Add a project history controller to Releeph

Summary: Ref T3663. There's no data recorded in this table yet, but add the UI and controller for it. Edits and such will eventually go here.

Test Plan: Clicked "View History" on a project, got an empty but non-broken page.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3663

Differential Revision: https://secure.phabricator.com/D6785
This commit is contained in:
epriestley 2013-08-20 10:00:25 -07:00
parent 596a531ed6
commit 8769759c15
6 changed files with 76 additions and 1 deletions

View file

@ -1974,10 +1974,12 @@ phutil_register_library_map(array(
'ReleephProjectController' => 'applications/releeph/controller/ReleephProjectController.php',
'ReleephProjectCreateController' => 'applications/releeph/controller/project/ReleephProjectCreateController.php',
'ReleephProjectEditController' => 'applications/releeph/controller/project/ReleephProjectEditController.php',
'ReleephProjectHistoryController' => 'applications/releeph/controller/project/ReleephProjectHistoryController.php',
'ReleephProjectListController' => 'applications/releeph/controller/project/ReleephProjectListController.php',
'ReleephProjectQuery' => 'applications/releeph/query/ReleephProjectQuery.php',
'ReleephProjectSearchEngine' => 'applications/releeph/query/ReleephProjectSearchEngine.php',
'ReleephProjectTransaction' => 'applications/releeph/storage/ReleephProjectTransaction.php',
'ReleephProjectTransactionQuery' => 'applications/releeph/query/ReleephProjectTransactionQuery.php',
'ReleephProjectViewController' => 'applications/releeph/controller/project/ReleephProjectViewController.php',
'ReleephReasonFieldSpecification' => 'applications/releeph/field/specification/ReleephReasonFieldSpecification.php',
'ReleephRequest' => 'applications/releeph/storage/ReleephRequest.php',
@ -4160,6 +4162,7 @@ phutil_register_library_map(array(
'ReleephProjectController' => 'ReleephController',
'ReleephProjectCreateController' => 'ReleephProjectController',
'ReleephProjectEditController' => 'ReleephProjectController',
'ReleephProjectHistoryController' => 'ReleephProjectController',
'ReleephProjectListController' =>
array(
0 => 'ReleephController',
@ -4168,6 +4171,7 @@ phutil_register_library_map(array(
'ReleephProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'ReleephProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
'ReleephProjectTransaction' => 'PhabricatorApplicationTransaction',
'ReleephProjectTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'ReleephProjectViewController' =>
array(
0 => 'ReleephProjectController',

View file

@ -42,6 +42,7 @@ final class PhabricatorApplicationReleeph extends PhabricatorApplication {
'edit/' => 'ReleephProjectEditController',
'cutbranch/' => 'ReleephBranchCreateController',
'action/(?P<action>.+)/' => 'ReleephProjectActionController',
'history/' => 'ReleephProjectHistoryController',
),
),
'branch/' => array(

View file

@ -0,0 +1,50 @@
<?php
final class ReleephProjectHistoryController extends ReleephProjectController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['projectID'];
parent::willProcessRequest($data);
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$project = id(new ReleephProjectQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->executeOne();
if (!$project) {
return new Aphront404Response();
}
$xactions = id(new ReleephProjectTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($project->getPHID()))
->execute();
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($project->getPHID())
->setTransactions($xactions);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addCrumb(
id(new PhabricatorCrumbView())
->setName(pht('History')));
return $this->buildApplicationPage(
array(
$crumbs,
$timeline,
),
array(
'title' => pht('Project History'),
'device' => true,
));
}
}

View file

@ -184,6 +184,8 @@ final class ReleephProjectViewController extends ReleephProjectController
$reactivate_uri = "project/{$id}/action/activate/";
$reactivate_uri = $this->getApplicationURI($reactivate_uri);
$history_uri = $this->getApplicationURI("project/{$id}/history/");
$actions->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Project'))
@ -212,6 +214,11 @@ final class ReleephProjectViewController 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 ReleephProjectTransactionQuery
extends PhabricatorApplicationTransactionQuery {
public function getTemplateApplicationTransaction() {
return new ReleephProjectTransaction();
}
}

View file

@ -30,9 +30,12 @@ abstract class PhabricatorApplicationTransaction
private $transactionGroup = array();
abstract public function getApplicationTransactionType();
abstract public function getApplicationTransactionCommentObject();
abstract public function getApplicationObjectTypeName();
public function getApplicationTransactionCommentObject() {
throw new Exception("Not implemented!");
}
public function getApplicationTransactionViewObject() {
return new PhabricatorApplicationTransactionView();
}