1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-22 04:31:13 +01:00

Add "Visible To" property fields for diffs and revisions

Summary: Ref T603. Show object visibility in the UI. This isn't editable or mutable yet, but will be after T2222.

Test Plan: {F48689} {F48690}

Reviewers: chad, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D6361
This commit is contained in:
epriestley 2013-07-03 11:29:57 -07:00
parent 70e7708aff
commit 64cc0ce128
4 changed files with 56 additions and 0 deletions

View file

@ -349,6 +349,7 @@ phutil_register_library_map(array(
'DifferentialDiffTableOfContentsView' => 'applications/differential/view/DifferentialDiffTableOfContentsView.php', 'DifferentialDiffTableOfContentsView' => 'applications/differential/view/DifferentialDiffTableOfContentsView.php',
'DifferentialDiffTestCase' => 'applications/differential/storage/__tests__/DifferentialDiffTestCase.php', 'DifferentialDiffTestCase' => 'applications/differential/storage/__tests__/DifferentialDiffTestCase.php',
'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php', 'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php',
'DifferentialDiffViewPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialDiffViewPolicyFieldSpecification.php',
'DifferentialException' => 'applications/differential/exception/DifferentialException.php', 'DifferentialException' => 'applications/differential/exception/DifferentialException.php',
'DifferentialExceptionMail' => 'applications/differential/mail/DifferentialExceptionMail.php', 'DifferentialExceptionMail' => 'applications/differential/mail/DifferentialExceptionMail.php',
'DifferentialExportPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php', 'DifferentialExportPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php',
@ -424,6 +425,7 @@ 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',
@ -2279,6 +2281,7 @@ phutil_register_library_map(array(
'DifferentialDiffTableOfContentsView' => 'AphrontView', 'DifferentialDiffTableOfContentsView' => 'AphrontView',
'DifferentialDiffTestCase' => 'ArcanistPhutilTestCase', 'DifferentialDiffTestCase' => 'ArcanistPhutilTestCase',
'DifferentialDiffViewController' => 'DifferentialController', 'DifferentialDiffViewController' => 'DifferentialController',
'DifferentialDiffViewPolicyFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialException' => 'Exception', 'DifferentialException' => 'Exception',
'DifferentialExceptionMail' => 'DifferentialMail', 'DifferentialExceptionMail' => 'DifferentialMail',
'DifferentialExportPatchFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialExportPatchFieldSpecification' => 'DifferentialFieldSpecification',
@ -2357,6 +2360,7 @@ 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

@ -13,6 +13,7 @@ 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(),
@ -30,6 +31,7 @@ final class DifferentialDefaultFieldSelector
new DifferentialDateModifiedFieldSpecification(), new DifferentialDateModifiedFieldSpecification(),
new DifferentialDateCreatedFieldSpecification(), new DifferentialDateCreatedFieldSpecification(),
new DifferentialAuditorsFieldSpecification(), new DifferentialAuditorsFieldSpecification(),
new DifferentialDiffViewPolicyFieldSpecification(),
); );
return $fields; return $fields;

View file

@ -0,0 +1,25 @@
<?php
final class DifferentialDiffViewPolicyFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnDiffView() {
return true;
}
public function renderLabelForDiffView() {
return pht('Visible To');
}
public function renderValueForDiffView() {
$user = $this->getUser();
$diff = $this->getDiff();
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$user,
$diff);
return idx($descriptions, PhabricatorPolicyCapability::CAN_VIEW);
}
}

View file

@ -0,0 +1,25 @@
<?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);
}
}