@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.

Let everyone view Herald rules

Summary:
Ref T9410. This changes the view policy for all Herald rules to the most public policy ("All Users" for private installs, "Public" for public installs).

See T11428 for discussion of this change in greater detail. In practice, this is //approximately// how things work today anyway, since you can almost always see almost all of this information in transcripts.

I believe this narrower view policy is helpful in zero cases and slightly confusing or harmful in a number of reasonable cases.

Test Plan: Viewed personal, object and global rules as users who could and could not edit the rules.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9410

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

+25 -20
+4
src/applications/herald/controller/HeraldRuleViewController.php
··· 2 2 3 3 final class HeraldRuleViewController extends HeraldController { 4 4 5 + public function shouldAllowPublic() { 6 + return true; 7 + } 8 + 5 9 public function handleRequest(AphrontRequest $request) { 6 10 $viewer = $request->getViewer(); 7 11 $id = $request->getURIData('id');
+21 -20
src/applications/herald/storage/HeraldRule.php
··· 288 288 } 289 289 290 290 public function getPolicy($capability) { 291 + if ($capability == PhabricatorPolicyCapability::CAN_VIEW) { 292 + return PhabricatorPolicies::getMostOpenPolicy(); 293 + } 294 + 291 295 if ($this->isGlobalRule()) { 292 - switch ($capability) { 293 - case PhabricatorPolicyCapability::CAN_VIEW: 294 - return PhabricatorPolicies::POLICY_USER; 295 - case PhabricatorPolicyCapability::CAN_EDIT: 296 - $app = 'PhabricatorHeraldApplication'; 297 - $herald = PhabricatorApplication::getByClass($app); 298 - $global = HeraldManageGlobalRulesCapability::CAPABILITY; 299 - return $herald->getPolicy($global); 300 - } 296 + $app = 'PhabricatorHeraldApplication'; 297 + $herald = PhabricatorApplication::getByClass($app); 298 + $global = HeraldManageGlobalRulesCapability::CAPABILITY; 299 + return $herald->getPolicy($global); 301 300 } else if ($this->isObjectRule()) { 302 301 return $this->getTriggerObject()->getPolicy($capability); 303 302 } else { 304 - return PhabricatorPolicies::POLICY_NOONE; 303 + return $this->getAuthorPHID(); 305 304 } 306 305 } 307 306 308 307 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 309 - if ($this->isPersonalRule()) { 310 - return ($viewer->getPHID() == $this->getAuthorPHID()); 311 - } else { 312 - return false; 313 - } 308 + return false; 314 309 } 315 310 316 311 public function describeAutomaticCapability($capability) { 317 - if ($this->isPersonalRule()) { 318 - return pht("A personal rule's owner can always view and edit it."); 319 - } else if ($this->isObjectRule()) { 320 - return pht('Object rules inherit the policies of their objects.'); 312 + if ($capability == PhabricatorPolicyCapability::CAN_VIEW) { 313 + return null; 321 314 } 322 315 323 - return null; 316 + if ($this->isGlobalRule()) { 317 + return pht( 318 + 'Global Herald rules can be edited by users with the "Can Manage '. 319 + 'Global Rules" Herald application permission.'); 320 + } else if ($this->isObjectRule()) { 321 + return pht('Object rules inherit the edit policies of their objects.'); 322 + } else { 323 + return pht('A personal rule can only be edited by its owner.'); 324 + } 324 325 } 325 326 326 327