@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add some missing strings for custom policies

Summary: Ref T603. Fix/provide some rendering stuff related to custom policies.

Test Plan: After setting stuff to custom policies (made easier by future diffs), looked at the various places strings appear in the UI and saw more sensible ones.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D7297

+24 -1
+5 -1
src/applications/policy/constants/PhabricatorPolicyType.php
··· 3 3 final class PhabricatorPolicyType extends PhabricatorPolicyConstants { 4 4 5 5 const TYPE_GLOBAL = 'global'; 6 + const TYPE_CUSTOM = 'custom'; 6 7 const TYPE_PROJECT = 'project'; 7 8 const TYPE_MASKED = 'masked'; 8 9 9 10 public static function getPolicyTypeOrder($type) { 10 11 static $map = array( 11 12 self::TYPE_GLOBAL => 0, 12 - self::TYPE_PROJECT => 1, 13 + self::TYPE_CUSTOM => 1, 14 + self::TYPE_PROJECT => 2, 13 15 self::TYPE_MASKED => 9, 14 16 ); 15 17 return idx($map, $type, 9); ··· 19 21 switch ($type) { 20 22 case self::TYPE_GLOBAL: 21 23 return pht('Basic Policies'); 24 + case self::TYPE_CUSTOM: 25 + return pht('Advanced'); 22 26 case self::TYPE_PROJECT: 23 27 return pht('Members of Project...'); 24 28 case self::TYPE_MASKED:
+19
src/applications/policy/storage/PhabricatorPolicy.php
··· 64 64 $policy->setType(PhabricatorPolicyType::TYPE_PROJECT); 65 65 $policy->setName($handle->getName()); 66 66 break; 67 + case PhabricatorPolicyPHIDTypePolicy::TYPECONST: 68 + // TODO: This creates a weird handle-based version of a rule policy. 69 + // It behaves correctly, but can't be applied since it doesn't have 70 + // any rules. It is used to render transactions, and might need some 71 + // cleanup. 72 + break; 67 73 default: 68 74 $policy->setType(PhabricatorPolicyType::TYPE_MASKED); 69 75 $policy->setName($handle->getFullName()); ··· 81 87 } 82 88 83 89 public function getType() { 90 + if (!$this->type) { 91 + return PhabricatorPolicyType::TYPE_CUSTOM; 92 + } 84 93 return $this->type; 85 94 } 86 95 ··· 90 99 } 91 100 92 101 public function getName() { 102 + if (!$this->name) { 103 + return pht('Custom Policy'); 104 + } 93 105 return $this->name; 94 106 } 95 107 ··· 116 128 case PhabricatorPolicyType::TYPE_PROJECT: 117 129 return 'policy-project'; 118 130 break; 131 + case PhabricatorPolicyType::TYPE_CUSTOM: 119 132 case PhabricatorPolicyType::TYPE_MASKED: 120 133 return 'policy-custom'; 121 134 break; ··· 173 186 return pht( 174 187 '%s can take this action.', 175 188 $handle->getFullName()); 189 + } else if ($type == PhabricatorPolicyPHIDTypePolicy::TYPECONST) { 190 + return pht( 191 + 'This object has a custom policy controlling who can take this '. 192 + 'action.'); 176 193 } else { 177 194 return pht( 178 195 'This object has an unknown or invalid policy setting ("%s").', ··· 222 239 switch ($this->getType()) { 223 240 case PhabricatorPolicyType::TYPE_PROJECT: 224 241 return pht('%s (Project)', $desc); 242 + case PhabricatorPolicyType::TYPE_CUSTOM: 243 + return pht('Custom Policy'); 225 244 case PhabricatorPolicyType::TYPE_MASKED: 226 245 return pht( 227 246 '%s (You do not have permission to view policy details.)',