From 8769759c153c8a4e46566f810f2217f99fe605af Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 20 Aug 2013 10:00:25 -0700 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 4 ++ .../PhabricatorApplicationReleeph.php | 1 + .../ReleephProjectHistoryController.php | 50 +++++++++++++++++++ .../project/ReleephProjectViewController.php | 7 +++ .../query/ReleephProjectTransactionQuery.php | 10 ++++ .../PhabricatorApplicationTransaction.php | 5 +- 6 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/applications/releeph/controller/project/ReleephProjectHistoryController.php create mode 100644 src/applications/releeph/query/ReleephProjectTransactionQuery.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 7caa1ae8dc..6209a98ac5 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/applications/releeph/application/PhabricatorApplicationReleeph.php b/src/applications/releeph/application/PhabricatorApplicationReleeph.php index 138003bcb7..593ec88108 100644 --- a/src/applications/releeph/application/PhabricatorApplicationReleeph.php +++ b/src/applications/releeph/application/PhabricatorApplicationReleeph.php @@ -42,6 +42,7 @@ final class PhabricatorApplicationReleeph extends PhabricatorApplication { 'edit/' => 'ReleephProjectEditController', 'cutbranch/' => 'ReleephBranchCreateController', 'action/(?P.+)/' => 'ReleephProjectActionController', + 'history/' => 'ReleephProjectHistoryController', ), ), 'branch/' => array( diff --git a/src/applications/releeph/controller/project/ReleephProjectHistoryController.php b/src/applications/releeph/controller/project/ReleephProjectHistoryController.php new file mode 100644 index 0000000000..e9df27f01c --- /dev/null +++ b/src/applications/releeph/controller/project/ReleephProjectHistoryController.php @@ -0,0 +1,50 @@ +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, + )); + } + +} diff --git a/src/applications/releeph/controller/project/ReleephProjectViewController.php b/src/applications/releeph/controller/project/ReleephProjectViewController.php index 8bab38551d..1b46f8a62a 100644 --- a/src/applications/releeph/controller/project/ReleephProjectViewController.php +++ b/src/applications/releeph/controller/project/ReleephProjectViewController.php @@ -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) diff --git a/src/applications/releeph/query/ReleephProjectTransactionQuery.php b/src/applications/releeph/query/ReleephProjectTransactionQuery.php new file mode 100644 index 0000000000..f7a6998ae6 --- /dev/null +++ b/src/applications/releeph/query/ReleephProjectTransactionQuery.php @@ -0,0 +1,10 @@ +