~ubuntu-branches/ubuntu/vivid/phabricator/vivid-proposed

« back to all changes in this revision

Viewing changes to phabricator/src/applications/releeph/controller/branch/ReleephBranchHistoryController.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2014-10-23 20:49:26 UTC
  • Revision ID: package-import@ubuntu.com-20141023204926-ar20vnfjqwxysrce
Tags: upstream-0~git20141023
ImportĀ upstreamĀ versionĀ 0~git20141023

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
final class ReleephBranchHistoryController extends ReleephBranchController {
 
4
 
 
5
  private $branchID;
 
6
 
 
7
  public function shouldAllowPublic() {
 
8
    return true;
 
9
  }
 
10
 
 
11
  public function willProcessRequest(array $data) {
 
12
    $this->branchID = $data['branchID'];
 
13
  }
 
14
 
 
15
  public function processRequest() {
 
16
    $request = $this->getRequest();
 
17
    $viewer = $request->getUser();
 
18
 
 
19
    $branch = id(new ReleephBranchQuery())
 
20
      ->setViewer($viewer)
 
21
      ->withIDs(array($this->branchID))
 
22
      ->executeOne();
 
23
    if (!$branch) {
 
24
      return new Aphront404Response();
 
25
    }
 
26
    $this->setBranch($branch);
 
27
 
 
28
    $xactions = id(new ReleephBranchTransactionQuery())
 
29
      ->setViewer($viewer)
 
30
      ->withObjectPHIDs(array($branch->getPHID()))
 
31
      ->execute();
 
32
 
 
33
    $timeline = id(new PhabricatorApplicationTransactionView())
 
34
      ->setUser($viewer)
 
35
      ->setObjectPHID($branch->getPHID())
 
36
      ->setTransactions($xactions)
 
37
      ->setShouldTerminate(true);
 
38
 
 
39
    $crumbs = $this->buildApplicationCrumbs();
 
40
    $crumbs->addTextCrumb(pht('History'));
 
41
 
 
42
    return $this->buildApplicationPage(
 
43
      array(
 
44
        $crumbs,
 
45
        $timeline,
 
46
      ),
 
47
      array(
 
48
        'title' => pht('Branch History'),
 
49
      ));
 
50
  }
 
51
 
 
52
}