1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 13:00:56 +01:00

Render public content as "Public" in headers, not "Public (No Login Required)"

Summary:
Ref T603. Although I think the parenthetical is valuable when //setting// policies to make sure no one accidentally opens content up, it's super annoying in headers.

This makes headers say "Public". Everything else still says "Public (No Login Required)".

Test Plan: {F69469}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D7310
This commit is contained in:
epriestley 2013-10-14 14:17:25 -07:00
parent e1e17a3378
commit 502c6f2d48
3 changed files with 24 additions and 1 deletions

View file

@ -147,6 +147,7 @@ final class PhabricatorPolicyQuery
->setType(PhabricatorPolicyType::TYPE_GLOBAL) ->setType(PhabricatorPolicyType::TYPE_GLOBAL)
->setPHID($constant) ->setPHID($constant)
->setName(self::getGlobalPolicyName($constant)) ->setName(self::getGlobalPolicyName($constant))
->setShortName(self::getGlobalPolicyShortName($constant))
->makeEphemeral(); ->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() { private function loadObjectPolicyPHIDs() {
$phids = array(); $phids = array();
$viewer = $this->getViewer(); $viewer = $this->getViewer();

View file

@ -8,6 +8,7 @@ final class PhabricatorPolicy
const ACTION_DENY = 'deny'; const ACTION_DENY = 'deny';
private $name; private $name;
private $shortName;
private $type; private $type;
private $href; private $href;
private $icon; private $icon;
@ -106,6 +107,18 @@ final class PhabricatorPolicy
return $this->name; 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) { public function setHref($href) {
$this->href = $href; $this->href = $href;
return $this; return $this;

View file

@ -224,7 +224,7 @@ final class PHUIHeaderView extends AphrontView {
'href' => '/policy/explain/'.$phid.'/'.$view_capability.'/', 'href' => '/policy/explain/'.$phid.'/'.$view_capability.'/',
'sigil' => 'workflow', 'sigil' => 'workflow',
), ),
$policy->getName()); $policy->getShortName());
return array($icon, $link); return array($icon, $link);
} }