diff --git a/src/applications/policy/query/PhabricatorPolicyQuery.php b/src/applications/policy/query/PhabricatorPolicyQuery.php index 55569356b5..9a078abf3e 100644 --- a/src/applications/policy/query/PhabricatorPolicyQuery.php +++ b/src/applications/policy/query/PhabricatorPolicyQuery.php @@ -147,6 +147,7 @@ final class PhabricatorPolicyQuery ->setType(PhabricatorPolicyType::TYPE_GLOBAL) ->setPHID($constant) ->setName(self::getGlobalPolicyName($constant)) + ->setShortName(self::getGlobalPolicyShortName($constant)) ->makeEphemeral(); } @@ -168,6 +169,15 @@ final class PhabricatorPolicyQuery } } + private static function getGlobalPolicyShortName($policy) { + switch ($policy) { + case PhabricatorPolicies::POLICY_PUBLIC: + return pht('Public'); + default: + return null; + } + } + private function loadObjectPolicyPHIDs() { $phids = array(); $viewer = $this->getViewer(); diff --git a/src/applications/policy/storage/PhabricatorPolicy.php b/src/applications/policy/storage/PhabricatorPolicy.php index 1ad41b4577..d124a10e5e 100644 --- a/src/applications/policy/storage/PhabricatorPolicy.php +++ b/src/applications/policy/storage/PhabricatorPolicy.php @@ -8,6 +8,7 @@ final class PhabricatorPolicy const ACTION_DENY = 'deny'; private $name; + private $shortName; private $type; private $href; private $icon; @@ -106,6 +107,18 @@ final class PhabricatorPolicy return $this->name; } + public function setShortName($short_name) { + $this->shortName = $short_name; + return $this; + } + + public function getShortName() { + if ($this->shortName) { + return $this->shortName; + } + return $this->getName(); + } + public function setHref($href) { $this->href = $href; return $this; diff --git a/src/view/phui/PHUIHeaderView.php b/src/view/phui/PHUIHeaderView.php index 1c960c98a7..5bfb58785a 100644 --- a/src/view/phui/PHUIHeaderView.php +++ b/src/view/phui/PHUIHeaderView.php @@ -224,7 +224,7 @@ final class PHUIHeaderView extends AphrontView { 'href' => '/policy/explain/'.$phid.'/'.$view_capability.'/', 'sigil' => 'workflow', ), - $policy->getName()); + $policy->getShortName()); return array($icon, $link); }