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

Implement PhabricatorProjectInterface in Paste

Summary: Ref T2628. Implements PhabricatorProjectInterface (D9340) in Paste.

Test Plan: See screenshots.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2628

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

+36 -1
+1
src/__phutil_library_map__.php
··· 4663 4663 2 => 'PhabricatorTokenReceiverInterface', 4664 4664 3 => 'PhabricatorFlaggableInterface', 4665 4665 4 => 'PhabricatorPolicyInterface', 4666 + 5 => 'PhabricatorProjectInterface', 4666 4667 ), 4667 4668 'PhabricatorPasteCommentController' => 'PhabricatorPasteController', 4668 4669 'PhabricatorPasteConfigOptions' => 'PhabricatorApplicationConfigOptions',
+31
src/applications/paste/controller/PhabricatorPasteEditController.php
··· 75 75 } 76 76 $v_policy = $paste->getViewPolicy(); 77 77 78 + if ($is_create) { 79 + $v_projects = array(); 80 + } else { 81 + $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( 82 + $paste->getPHID(), 83 + PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); 84 + $v_projects = array_reverse($v_projects); 85 + } 86 + 78 87 if ($request->isFormPost()) { 79 88 $xactions = array(); 80 89 ··· 89 98 $v_title = $request->getStr('title'); 90 99 $v_language = $request->getStr('language'); 91 100 $v_policy = $request->getStr('can_view'); 101 + $v_projects = $request->getArr('projects'); 92 102 93 103 // NOTE: The author is the only editor and can always view the paste, 94 104 // so it's impossible for them to choose an invalid policy. ··· 114 124 $xactions[] = id(new PhabricatorPasteTransaction()) 115 125 ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) 116 126 ->setNewValue($v_policy); 127 + 128 + $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; 129 + $xactions[] = id(new PhabricatorPasteTransaction()) 130 + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 131 + ->setMetadataValue('edge:type', $proj_edge_type) 132 + ->setNewValue(array('=' => array_fuse($v_projects))); 133 + 117 134 $editor = id(new PhabricatorPasteEditor()) 118 135 ->setActor($user) 119 136 ->setContentSourceFromRequest($request) ··· 160 177 ->setPolicyObject($paste) 161 178 ->setPolicies($policies) 162 179 ->setName('can_view')); 180 + 181 + 182 + if ($v_projects) { 183 + $project_handles = $this->loadViewerHandles($v_projects); 184 + } else { 185 + $project_handles = array(); 186 + } 187 + 188 + $form->appendChild( 189 + id(new AphrontFormTokenizerControl()) 190 + ->setLabel(pht('Projects')) 191 + ->setName('projects') 192 + ->setValue($project_handles) 193 + ->setDatasource('/typeahead/common/projects/')); 163 194 164 195 $form 165 196 ->appendChild(
+2
src/applications/paste/editor/PhabricatorPasteEditor.php
··· 77 77 return; 78 78 case PhabricatorTransactions::TYPE_COMMENT: 79 79 case PhabricatorTransactions::TYPE_SUBSCRIBERS: 80 + case PhabricatorTransactions::TYPE_EDGE: 80 81 return; 81 82 } 82 83 ··· 94 95 case PhabricatorTransactions::TYPE_VIEW_POLICY: 95 96 case PhabricatorTransactions::TYPE_COMMENT: 96 97 case PhabricatorTransactions::TYPE_SUBSCRIBERS: 98 + case PhabricatorTransactions::TYPE_EDGE: 97 99 return; 98 100 } 99 101
+2 -1
src/applications/paste/storage/PhabricatorPaste.php
··· 5 5 PhabricatorSubscribableInterface, 6 6 PhabricatorTokenReceiverInterface, 7 7 PhabricatorFlaggableInterface, 8 - PhabricatorPolicyInterface { 8 + PhabricatorPolicyInterface, 9 + PhabricatorProjectInterface { 9 10 10 11 protected $title; 11 12 protected $authorPHID;