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

Support Spaces in Pholio

Summary:
Ref T8493. Add Spaces support to Pholio.

This is straightforward; Pholio has no clone/copy/fork or weird parent/child stuff going on.

Test Plan: Created a mock, put it in a space, looked at it as another user, searched for stuff in spaces, viewed Macros.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8493

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

+44 -12
+2
resources/sql/autopatches/20150609.spaces.1.pholio.sql
··· 1 + ALTER TABLE {$NAMESPACE}_pholio.pholio_mock 2 + ADD spacePHID VARBINARY(64);
+1 -2
src/__phutil_library_map__.php
··· 2580 2580 'PhabricatorSpacesCapabilityCreateSpaces' => 'applications/spaces/capability/PhabricatorSpacesCapabilityCreateSpaces.php', 2581 2581 'PhabricatorSpacesCapabilityDefaultEdit' => 'applications/spaces/capability/PhabricatorSpacesCapabilityDefaultEdit.php', 2582 2582 'PhabricatorSpacesCapabilityDefaultView' => 'applications/spaces/capability/PhabricatorSpacesCapabilityDefaultView.php', 2583 - 'PhabricatorSpacesControl' => 'applications/spaces/view/PhabricatorSpacesControl.php', 2584 2583 'PhabricatorSpacesController' => 'applications/spaces/controller/PhabricatorSpacesController.php', 2585 2584 'PhabricatorSpacesDAO' => 'applications/spaces/storage/PhabricatorSpacesDAO.php', 2586 2585 'PhabricatorSpacesEditController' => 'applications/spaces/controller/PhabricatorSpacesEditController.php', ··· 6091 6090 'PhabricatorSpacesCapabilityCreateSpaces' => 'PhabricatorPolicyCapability', 6092 6091 'PhabricatorSpacesCapabilityDefaultEdit' => 'PhabricatorPolicyCapability', 6093 6092 'PhabricatorSpacesCapabilityDefaultView' => 'PhabricatorPolicyCapability', 6094 - 'PhabricatorSpacesControl' => 'AphrontFormControl', 6095 6093 'PhabricatorSpacesController' => 'PhabricatorController', 6096 6094 'PhabricatorSpacesDAO' => 'PhabricatorLiskDAO', 6097 6095 'PhabricatorSpacesEditController' => 'PhabricatorSpacesController', ··· 6418 6416 'PhabricatorApplicationTransactionInterface', 6419 6417 'PhabricatorProjectInterface', 6420 6418 'PhabricatorDestructibleInterface', 6419 + 'PhabricatorSpacesInterface', 6421 6420 ), 6422 6421 'PholioMockCommentController' => 'PholioController', 6423 6422 'PholioMockEditController' => 'PholioController',
+4 -1
src/applications/macro/query/PhabricatorMacroSearchEngine.php
··· 141 141 foreach ($macros as $macro) { 142 142 $file = $macro->getFile(); 143 143 144 - $item = new PHUIPinboardItemView(); 144 + $item = id(new PHUIPinboardItemView()) 145 + ->setUser($viewer) 146 + ->setObject($macro); 147 + 145 148 if ($file) { 146 149 $item->setImageURI($file->getURIForTransform($xform)); 147 150 list($x, $y) = $xform->getTransformedDimensions($file);
+5
src/applications/pholio/controller/PholioMockEditController.php
··· 65 65 $v_edit = $mock->getEditPolicy(); 66 66 $v_cc = PhabricatorSubscribersQuery::loadSubscribersForPHID( 67 67 $mock->getPHID()); 68 + $v_space = $mock->getSpacePHID(); 68 69 69 70 if ($request->isFormPost()) { 70 71 $xactions = array(); ··· 75 76 $type_view = PhabricatorTransactions::TYPE_VIEW_POLICY; 76 77 $type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY; 77 78 $type_cc = PhabricatorTransactions::TYPE_SUBSCRIBERS; 79 + $type_space = PhabricatorTransactions::TYPE_SPACE; 78 80 79 81 $v_name = $request->getStr('name'); 80 82 $v_desc = $request->getStr('description'); ··· 83 85 $v_edit = $request->getStr('can_edit'); 84 86 $v_cc = $request->getArr('cc'); 85 87 $v_projects = $request->getArr('projects'); 88 + $v_space = $request->getStr('spacePHID'); 86 89 87 90 $mock_xactions = array(); 88 91 $mock_xactions[$type_name] = $v_name; ··· 91 94 $mock_xactions[$type_view] = $v_view; 92 95 $mock_xactions[$type_edit] = $v_edit; 93 96 $mock_xactions[$type_cc] = array('=' => $v_cc); 97 + $mock_xactions[$type_space] = $v_space; 94 98 95 99 if (!strlen($request->getStr('name'))) { 96 100 $e_name = pht('Required'); ··· 350 354 ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) 351 355 ->setPolicyObject($mock) 352 356 ->setPolicies($policies) 357 + ->setSpacePHID($v_space) 353 358 ->setName('can_view')) 354 359 ->appendChild( 355 360 id(new AphrontFormPolicyControl())
+3 -6
src/applications/pholio/query/PholioMockSearchEngine.php
··· 83 83 return parent::buildSavedQueryFromBuiltin($query_key); 84 84 } 85 85 86 - protected function getRequiredHandlePHIDsForResultList( 87 - array $mocks, 88 - PhabricatorSavedQuery $query) { 89 - return mpull($mocks, 'getAuthorPHID'); 90 - } 91 - 92 86 protected function renderResultList( 93 87 array $mocks, 94 88 PhabricatorSavedQuery $query, ··· 96 90 assert_instances_of($mocks, 'PholioMock'); 97 91 98 92 $viewer = $this->requireViewer(); 93 + $handles = $viewer->loadHandles(mpull($mocks, 'getAuthorPHID')); 99 94 100 95 $xform = PhabricatorFileTransform::getTransformByKey( 101 96 PhabricatorFileThumbnailTransform::TRANSFORM_PINBOARD); ··· 109 104 110 105 $header = 'M'.$mock->getID().' '.$mock->getName(); 111 106 $item = id(new PHUIPinboardItemView()) 107 + ->setUser($viewer) 112 108 ->setHeader($header) 109 + ->setObject($mock) 113 110 ->setURI('/M'.$mock->getID()) 114 111 ->setImageURI($image_uri) 115 112 ->setImageSize($x, $y)
+12 -1
src/applications/pholio/storage/PholioMock.php
··· 9 9 PhabricatorFlaggableInterface, 10 10 PhabricatorApplicationTransactionInterface, 11 11 PhabricatorProjectInterface, 12 - PhabricatorDestructibleInterface { 12 + PhabricatorDestructibleInterface, 13 + PhabricatorSpacesInterface { 13 14 14 15 const MARKUP_FIELD_DESCRIPTION = 'markup:description'; 15 16 ··· 26 27 protected $coverPHID; 27 28 protected $mailKey; 28 29 protected $status; 30 + protected $spacePHID; 29 31 30 32 private $images = self::ATTACHABLE; 31 33 private $allImages = self::ATTACHABLE; ··· 307 309 $this->delete(); 308 310 $this->saveTransaction(); 309 311 } 312 + 313 + 314 + /* -( PhabricatorSpacesInterface )----------------------------------------- */ 315 + 316 + 317 + public function getSpacePHID() { 318 + return $this->spacePHID; 319 + } 320 + 310 321 311 322 }
+17 -2
src/view/phui/PHUIPinboardItemView.php
··· 7 7 private $header; 8 8 private $iconBlock = array(); 9 9 private $disabled; 10 - 10 + private $object; 11 11 private $imageWidth; 12 12 private $imageHeight; 13 13 ··· 42 42 return $this; 43 43 } 44 44 45 + public function setObject($object) { 46 + $this->object = $object; 47 + return $this; 48 + } 49 + 45 50 public function render() { 46 51 require_celerity_resource('phui-pinboard-view-css'); 47 52 $header = null; ··· 57 62 'class' => 'phui-pinboard-item-header '. 58 63 'sprite-gradient '.$header_color, 59 64 ), 60 - phutil_tag('a', array('href' => $this->uri), $this->header)); 65 + array( 66 + id(new PHUISpacesNamespaceContextView()) 67 + ->setUser($this->getUser()) 68 + ->setObject($this->object), 69 + phutil_tag( 70 + 'a', 71 + array( 72 + 'href' => $this->uri, 73 + ), 74 + $this->header), 75 + )); 61 76 } 62 77 63 78 $image = null;