1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +01:00

Show policy information in Differential header

Summary: Ref T603. Moves policy information from a custom field to the header for revisions.

Test Plan: Looked at a revision.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D7135
This commit is contained in:
epriestley 2013-09-26 12:37:05 -07:00
parent d61c931c7b
commit 80378eb5f6
5 changed files with 4 additions and 29 deletions

View file

@ -428,7 +428,6 @@ phutil_register_library_map(array(
'DifferentialUnitFieldSpecification' => 'applications/differential/field/specification/DifferentialUnitFieldSpecification.php', 'DifferentialUnitFieldSpecification' => 'applications/differential/field/specification/DifferentialUnitFieldSpecification.php',
'DifferentialUnitStatus' => 'applications/differential/constants/DifferentialUnitStatus.php', 'DifferentialUnitStatus' => 'applications/differential/constants/DifferentialUnitStatus.php',
'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php', 'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php',
'DifferentialViewPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialViewPolicyFieldSpecification.php',
'DiffusionBranchInformation' => 'applications/diffusion/data/DiffusionBranchInformation.php', 'DiffusionBranchInformation' => 'applications/diffusion/data/DiffusionBranchInformation.php',
'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php', 'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php',
'DiffusionBranchTableView' => 'applications/diffusion/view/DiffusionBranchTableView.php', 'DiffusionBranchTableView' => 'applications/diffusion/view/DiffusionBranchTableView.php',
@ -2500,7 +2499,6 @@ phutil_register_library_map(array(
'DifferentialTransaction' => 'PhabricatorApplicationTransaction', 'DifferentialTransaction' => 'PhabricatorApplicationTransaction',
'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment', 'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment',
'DifferentialUnitFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialUnitFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialViewPolicyFieldSpecification' => 'DifferentialFieldSpecification',
'DiffusionBranchTableController' => 'DiffusionController', 'DiffusionBranchTableController' => 'DiffusionController',
'DiffusionBranchTableView' => 'DiffusionView', 'DiffusionBranchTableView' => 'DiffusionView',
'DiffusionBrowseController' => 'DiffusionController', 'DiffusionBrowseController' => 'DiffusionController',

View file

@ -232,6 +232,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
} }
$revision_detail = id(new DifferentialRevisionDetailView()) $revision_detail = id(new DifferentialRevisionDetailView())
->setUser($user)
->setRevision($revision) ->setRevision($revision)
->setDiff(end($diffs)) ->setDiff(end($diffs))
->setAuxiliaryFields($aux_fields) ->setAuxiliaryFields($aux_fields)

View file

@ -13,7 +13,6 @@ final class DifferentialDefaultFieldSelector
new DifferentialReviewersFieldSpecification(), new DifferentialReviewersFieldSpecification(),
new DifferentialReviewedByFieldSpecification(), new DifferentialReviewedByFieldSpecification(),
new DifferentialCCsFieldSpecification(), new DifferentialCCsFieldSpecification(),
new DifferentialViewPolicyFieldSpecification(),
new DifferentialLintFieldSpecification(), new DifferentialLintFieldSpecification(),
new DifferentialUnitFieldSpecification(), new DifferentialUnitFieldSpecification(),
new DifferentialCommitsFieldSpecification(), new DifferentialCommitsFieldSpecification(),

View file

@ -1,25 +0,0 @@
<?php
final class DifferentialViewPolicyFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return pht('Visible To');
}
public function renderValueForRevisionView() {
$user = $this->getUser();
$revision = $this->getRevision();
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$user,
$revision);
return idx($descriptions, PhabricatorPolicyCapability::CAN_VIEW);
}
}

View file

@ -120,7 +120,9 @@ final class DifferentialRevisionDetailView extends AphrontView {
private function renderHeader(DifferentialRevision $revision) { private function renderHeader(DifferentialRevision $revision) {
$view = id(new PHUIHeaderView()) $view = id(new PHUIHeaderView())
->setHeader($revision->getTitle($revision)); ->setHeader($revision->getTitle($revision))
->setUser($this->getUser())
->setPolicyObject($revision);
$status = $revision->getStatus(); $status = $revision->getStatus();
$status_name = $status_name =