1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

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
This commit is contained in:
epriestley 2013-10-14 12:05:43 -07:00
parent 6c1b00fa40
commit 7364a3bedd
2 changed files with 24 additions and 1 deletions

View file

@ -3,13 +3,15 @@
final class PhabricatorPolicyType extends PhabricatorPolicyConstants {
const TYPE_GLOBAL = 'global';
const TYPE_CUSTOM = 'custom';
const TYPE_PROJECT = 'project';
const TYPE_MASKED = 'masked';
public static function getPolicyTypeOrder($type) {
static $map = array(
self::TYPE_GLOBAL => 0,
self::TYPE_PROJECT => 1,
self::TYPE_CUSTOM => 1,
self::TYPE_PROJECT => 2,
self::TYPE_MASKED => 9,
);
return idx($map, $type, 9);
@ -19,6 +21,8 @@ final class PhabricatorPolicyType extends PhabricatorPolicyConstants {
switch ($type) {
case self::TYPE_GLOBAL:
return pht('Basic Policies');
case self::TYPE_CUSTOM:
return pht('Advanced');
case self::TYPE_PROJECT:
return pht('Members of Project...');
case self::TYPE_MASKED:

View file

@ -64,6 +64,12 @@ final class PhabricatorPolicy
$policy->setType(PhabricatorPolicyType::TYPE_PROJECT);
$policy->setName($handle->getName());
break;
case PhabricatorPolicyPHIDTypePolicy::TYPECONST:
// TODO: This creates a weird handle-based version of a rule policy.
// It behaves correctly, but can't be applied since it doesn't have
// any rules. It is used to render transactions, and might need some
// cleanup.
break;
default:
$policy->setType(PhabricatorPolicyType::TYPE_MASKED);
$policy->setName($handle->getFullName());
@ -81,6 +87,9 @@ final class PhabricatorPolicy
}
public function getType() {
if (!$this->type) {
return PhabricatorPolicyType::TYPE_CUSTOM;
}
return $this->type;
}
@ -90,6 +99,9 @@ final class PhabricatorPolicy
}
public function getName() {
if (!$this->name) {
return pht('Custom Policy');
}
return $this->name;
}
@ -116,6 +128,7 @@ final class PhabricatorPolicy
case PhabricatorPolicyType::TYPE_PROJECT:
return 'policy-project';
break;
case PhabricatorPolicyType::TYPE_CUSTOM:
case PhabricatorPolicyType::TYPE_MASKED:
return 'policy-custom';
break;
@ -173,6 +186,10 @@ final class PhabricatorPolicy
return pht(
'%s can take this action.',
$handle->getFullName());
} else if ($type == PhabricatorPolicyPHIDTypePolicy::TYPECONST) {
return pht(
'This object has a custom policy controlling who can take this '.
'action.');
} else {
return pht(
'This object has an unknown or invalid policy setting ("%s").',
@ -222,6 +239,8 @@ final class PhabricatorPolicy
switch ($this->getType()) {
case PhabricatorPolicyType::TYPE_PROJECT:
return pht('%s (Project)', $desc);
case PhabricatorPolicyType::TYPE_CUSTOM:
return pht('Custom Policy');
case PhabricatorPolicyType::TYPE_MASKED:
return pht(
'%s (You do not have permission to view policy details.)',