mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +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:
parent
70e7708aff
commit
64cc0ce128
4 changed files with 56 additions and 0 deletions
|
@ -349,6 +349,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialDiffTableOfContentsView' => 'applications/differential/view/DifferentialDiffTableOfContentsView.php',
|
||||
'DifferentialDiffTestCase' => 'applications/differential/storage/__tests__/DifferentialDiffTestCase.php',
|
||||
'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php',
|
||||
'DifferentialDiffViewPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialDiffViewPolicyFieldSpecification.php',
|
||||
'DifferentialException' => 'applications/differential/exception/DifferentialException.php',
|
||||
'DifferentialExceptionMail' => 'applications/differential/mail/DifferentialExceptionMail.php',
|
||||
'DifferentialExportPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php',
|
||||
|
@ -424,6 +425,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialUnitFieldSpecification' => 'applications/differential/field/specification/DifferentialUnitFieldSpecification.php',
|
||||
'DifferentialUnitStatus' => 'applications/differential/constants/DifferentialUnitStatus.php',
|
||||
'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php',
|
||||
'DifferentialViewPolicyFieldSpecification' => 'applications/differential/field/specification/DifferentialViewPolicyFieldSpecification.php',
|
||||
'DiffusionBranchInformation' => 'applications/diffusion/data/DiffusionBranchInformation.php',
|
||||
'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php',
|
||||
'DiffusionBranchTableView' => 'applications/diffusion/view/DiffusionBranchTableView.php',
|
||||
|
@ -2279,6 +2281,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialDiffTableOfContentsView' => 'AphrontView',
|
||||
'DifferentialDiffTestCase' => 'ArcanistPhutilTestCase',
|
||||
'DifferentialDiffViewController' => 'DifferentialController',
|
||||
'DifferentialDiffViewPolicyFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
'DifferentialException' => 'Exception',
|
||||
'DifferentialExceptionMail' => 'DifferentialMail',
|
||||
'DifferentialExportPatchFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
|
@ -2357,6 +2360,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||
'DifferentialUnitFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
'DifferentialViewPolicyFieldSpecification' => 'DifferentialFieldSpecification',
|
||||
'DiffusionBranchTableController' => 'DiffusionController',
|
||||
'DiffusionBranchTableView' => 'DiffusionView',
|
||||
'DiffusionBrowseController' => 'DiffusionController',
|
||||
|
|
|
@ -13,6 +13,7 @@ final class DifferentialDefaultFieldSelector
|
|||
new DifferentialReviewersFieldSpecification(),
|
||||
new DifferentialReviewedByFieldSpecification(),
|
||||
new DifferentialCCsFieldSpecification(),
|
||||
new DifferentialViewPolicyFieldSpecification(),
|
||||
new DifferentialLintFieldSpecification(),
|
||||
new DifferentialUnitFieldSpecification(),
|
||||
new DifferentialCommitsFieldSpecification(),
|
||||
|
@ -30,6 +31,7 @@ final class DifferentialDefaultFieldSelector
|
|||
new DifferentialDateModifiedFieldSpecification(),
|
||||
new DifferentialDateCreatedFieldSpecification(),
|
||||
new DifferentialAuditorsFieldSpecification(),
|
||||
new DifferentialDiffViewPolicyFieldSpecification(),
|
||||
);
|
||||
|
||||
return $fields;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue