Page MenuHomePhabricator

D13702.diff
No OneTemporary

D13702.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1625,7 +1625,6 @@
'PhabricatorBadgesCreateCapability' => 'applications/badges/capability/PhabricatorBadgesCreateCapability.php',
'PhabricatorBadgesDAO' => 'applications/badges/storage/PhabricatorBadgesDAO.php',
'PhabricatorBadgesDefaultEditCapability' => 'applications/badges/capability/PhabricatorBadgesDefaultEditCapability.php',
- 'PhabricatorBadgesDefaultViewCapability' => 'applications/badges/capability/PhabricatorBadgesDefaultViewCapability.php',
'PhabricatorBadgesEditController' => 'applications/badges/controller/PhabricatorBadgesEditController.php',
'PhabricatorBadgesEditIconController' => 'applications/badges/controller/PhabricatorBadgesEditIconController.php',
'PhabricatorBadgesEditRecipientsController' => 'applications/badges/controller/PhabricatorBadgesEditRecipientsController.php',
@@ -5380,7 +5379,6 @@
'PhabricatorBadgesCreateCapability' => 'PhabricatorPolicyCapability',
'PhabricatorBadgesDAO' => 'PhabricatorLiskDAO',
'PhabricatorBadgesDefaultEditCapability' => 'PhabricatorPolicyCapability',
- 'PhabricatorBadgesDefaultViewCapability' => 'PhabricatorPolicyCapability',
'PhabricatorBadgesEditController' => 'PhabricatorBadgesController',
'PhabricatorBadgesEditIconController' => 'PhabricatorBadgesController',
'PhabricatorBadgesEditRecipientsController' => 'PhabricatorBadgesController',
diff --git a/src/applications/badges/application/PhabricatorBadgesApplication.php b/src/applications/badges/application/PhabricatorBadgesApplication.php
--- a/src/applications/badges/application/PhabricatorBadgesApplication.php
+++ b/src/applications/badges/application/PhabricatorBadgesApplication.php
@@ -71,10 +71,6 @@
'caption' => pht('Default edit policy for badges.'),
'template' => PhabricatorBadgesPHIDType::TYPECONST,
),
- PhabricatorBadgesDefaultViewCapability::CAPABILITY => array(
- 'caption' => pht('Default view policy for badges.'),
- 'template' => PhabricatorBadgesPHIDType::TYPECONST,
- ),
);
}
diff --git a/src/applications/badges/capability/PhabricatorBadgesDefaultViewCapability.php b/src/applications/badges/capability/PhabricatorBadgesDefaultViewCapability.php
deleted file mode 100644
--- a/src/applications/badges/capability/PhabricatorBadgesDefaultViewCapability.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-final class PhabricatorBadgesDefaultViewCapability extends
- PhabricatorPolicyCapability {
-
- const CAPABILITY = 'badges.default.view';
-
- public function getCapabilityName() {
- return pht('Default View Policy');
- }
-
- public function shouldAllowPublicPolicySetting() {
- return true;
- }
-
-}
diff --git a/src/applications/badges/controller/PhabricatorBadgesEditController.php b/src/applications/badges/controller/PhabricatorBadgesEditController.php
--- a/src/applications/badges/controller/PhabricatorBadgesEditController.php
+++ b/src/applications/badges/controller/PhabricatorBadgesEditController.php
@@ -49,7 +49,6 @@
$v_stat = $badge->getStatus();
$v_edit = $badge->getEditPolicy();
- $v_view = $badge->getViewPolicy();
$validation_exception = null;
if ($request->isFormPost()) {
@@ -70,7 +69,6 @@
$type_qual = PhabricatorBadgesTransaction::TYPE_QUALITY;
$type_stat = PhabricatorBadgesTransaction::TYPE_STATUS;
- $type_view = PhabricatorTransactions::TYPE_VIEW_POLICY;
$type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY;
$xactions = array();
@@ -100,10 +98,6 @@
->setNewValue($v_stat);
$xactions[] = id(new PhabricatorBadgesTransaction())
- ->setTransactionType($type_view)
- ->setNewValue($v_view);
-
- $xactions[] = id(new PhabricatorBadgesTransaction())
->setTransactionType($type_edit)
->setNewValue($v_edit);
@@ -177,13 +171,6 @@
->setValue($v_desc))
->appendChild(
id(new AphrontFormPolicyControl())
- ->setName('viewPolicy')
- ->setPolicyObject($badge)
- ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
- ->setValue($v_view)
- ->setPolicies($policies))
- ->appendChild(
- id(new AphrontFormPolicyControl())
->setName('editPolicy')
->setPolicyObject($badge)
->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
diff --git a/src/applications/badges/editor/PhabricatorBadgesEditor.php b/src/applications/badges/editor/PhabricatorBadgesEditor.php
--- a/src/applications/badges/editor/PhabricatorBadgesEditor.php
+++ b/src/applications/badges/editor/PhabricatorBadgesEditor.php
@@ -23,7 +23,6 @@
$types[] = PhabricatorTransactions::TYPE_COMMENT;
$types[] = PhabricatorTransactions::TYPE_EDGE;
- $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
return $types;
diff --git a/src/applications/badges/storage/PhabricatorBadgesBadge.php b/src/applications/badges/storage/PhabricatorBadgesBadge.php
--- a/src/applications/badges/storage/PhabricatorBadgesBadge.php
+++ b/src/applications/badges/storage/PhabricatorBadgesBadge.php
@@ -63,8 +63,7 @@
->withClasses(array('PhabricatorBadgesApplication'))
->executeOne();
- $view_policy =
- $app->getPolicy(PhabricatorBadgesDefaultViewCapability::CAPABILITY);
+ $view_policy = PhabricatorPolicies::getMostOpenPolicy();
$edit_policy =
$app->getPolicy(PhabricatorBadgesDefaultEditCapability::CAPABILITY);
@@ -129,7 +128,7 @@
public function getPolicy($capability) {
switch ($capability) {
case PhabricatorPolicyCapability::CAN_VIEW:
- return $this->getViewPolicy();
+ return PhabricatorPolicies::getMostOpenPolicy();
case PhabricatorPolicyCapability::CAN_EDIT:
return $this->getEditPolicy();
}

File Metadata

Mime Type
text/plain
Expires
Oct 16 2024, 7:56 PM (4 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710670
Default Alt Text
D13702.diff (5 KB)

Event Timeline