@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 a defualt view policy for Pholio

Summary: Similar to D8110, but for Pholio. Also an IRC user request.

Test Plan: Set setting to something unusual, created a new mock.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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

+44 -7
+2
src/__phutil_library_map__.php
··· 2197 2197 'PhluxVariableQuery' => 'applications/phlux/query/PhluxVariableQuery.php', 2198 2198 'PhluxViewController' => 'applications/phlux/controller/PhluxViewController.php', 2199 2199 'PholioActionMenuEventListener' => 'applications/pholio/event/PholioActionMenuEventListener.php', 2200 + 'PholioCapabilityDefaultView' => 'applications/pholio/capability/PholioCapabilityDefaultView.php', 2200 2201 'PholioConstants' => 'applications/pholio/constants/PholioConstants.php', 2201 2202 'PholioController' => 'applications/pholio/controller/PholioController.php', 2202 2203 'PholioDAO' => 'applications/pholio/storage/PholioDAO.php', ··· 4938 4939 'PhluxVariableQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 4939 4940 'PhluxViewController' => 'PhluxController', 4940 4941 'PholioActionMenuEventListener' => 'PhabricatorEventListener', 4942 + 'PholioCapabilityDefaultView' => 'PhabricatorPolicyCapability', 4941 4943 'PholioController' => 'PhabricatorController', 4942 4944 'PholioDAO' => 'PhabricatorLiskDAO', 4943 4945 'PholioImage' =>
+7
src/applications/pholio/application/PhabricatorApplicationPholio.php
··· 82 82 return $items; 83 83 } 84 84 85 + protected function getCustomCapabilities() { 86 + return array( 87 + PholioCapabilityDefaultView::CAPABILITY => array( 88 + ), 89 + ); 90 + } 91 + 85 92 }
+20
src/applications/pholio/capability/PholioCapabilityDefaultView.php
··· 1 + <?php 2 + 3 + final class PholioCapabilityDefaultView 4 + extends PhabricatorPolicyCapability { 5 + 6 + const CAPABILITY = 'pholio.default.view'; 7 + 8 + public function getCapabilityKey() { 9 + return self::CAPABILITY; 10 + } 11 + 12 + public function getCapabilityName() { 13 + return pht('Default View Policy'); 14 + } 15 + 16 + public function shouldAllowPublicPolicySetting() { 17 + return true; 18 + } 19 + 20 + }
+1 -4
src/applications/pholio/controller/PholioMockEditController.php
··· 38 38 $files = mpull($mock_images, 'getFile'); 39 39 $mock_images = mpull($mock_images, null, 'getFilePHID'); 40 40 } else { 41 - $mock = id(new PholioMock()) 42 - ->setAuthorPHID($user->getPHID()) 43 - ->attachImages(array()) 44 - ->setViewPolicy(PhabricatorPolicies::POLICY_USER); 41 + $mock = PholioMock::initializeNewMock($user); 45 42 46 43 $title = pht('Create Mock'); 47 44
+14 -3
src/applications/pholio/storage/PholioMock.php
··· 1 1 <?php 2 2 3 - /** 4 - * @group pholio 5 - */ 6 3 final class PholioMock extends PholioDAO 7 4 implements 8 5 PhabricatorMarkupInterface, ··· 27 24 private $allImages = self::ATTACHABLE; 28 25 private $coverFile = self::ATTACHABLE; 29 26 private $tokenCount = self::ATTACHABLE; 27 + 28 + public static function initializeNewMock(PhabricatorUser $actor) { 29 + $app = id(new PhabricatorApplicationQuery()) 30 + ->setViewer($actor) 31 + ->withClasses(array('PhabricatorApplicationPholio')) 32 + ->executeOne(); 33 + 34 + $view_policy = $app->getPolicy(PholioCapabilityDefaultView::CAPABILITY); 35 + 36 + return id(new PholioMock()) 37 + ->setAuthorPHID($actor->getPHID()) 38 + ->attachImages(array()) 39 + ->setViewPolicy($view_policy); 40 + } 30 41 31 42 public function getConfiguration() { 32 43 return array(