@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 policy header and actions to repositories

Summary: Get thee modernized.

Test Plan: See screenshot.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

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

+33 -2
+33 -2
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 137 137 $user = $this->getRequest()->getUser(); 138 138 139 139 $header = id(new PHUIHeaderView()) 140 - ->setHeader($repository->getName()); 140 + ->setHeader($repository->getName()) 141 + ->setUser($user) 142 + ->setPolicyObject($repository); 143 + 144 + $actions = $this->buildActionList($repository); 141 145 142 146 $view = id(new PhabricatorPropertyListView()) 143 147 ->setUser($user); ··· 166 170 $view->addTextContent($description); 167 171 } 168 172 169 - return array($header, $view); 173 + return array($header, $actions, $view); 170 174 } 171 175 172 176 private function buildBranchListTable(DiffusionRequest $drequest) { ··· 286 290 $panel->appendChild($view); 287 291 288 292 return $panel; 293 + } 294 + 295 + private function buildActionList(PhabricatorRepository $repository) { 296 + $viewer = $this->getRequest()->getUser(); 297 + 298 + $view_uri = $this->getApplicationURI($repository->getCallsign().'/'); 299 + $edit_uri = $this->getApplicationURI($repository->getCallsign().'/edit/'); 300 + 301 + $view = id(new PhabricatorActionListView()) 302 + ->setUser($viewer) 303 + ->setObject($repository) 304 + ->setObjectURI($view_uri); 305 + 306 + $can_edit = PhabricatorPolicyFilter::hasCapability( 307 + $viewer, 308 + $repository, 309 + PhabricatorPolicyCapability::CAN_EDIT); 310 + 311 + $view->addAction( 312 + id(new PhabricatorActionView()) 313 + ->setName(pht('Edit Repository')) 314 + ->setIcon('edit') 315 + ->setHref($edit_uri) 316 + ->setWorkflow(!$can_edit) 317 + ->setDisabled(!$can_edit)); 318 + 319 + return $view; 289 320 } 290 321 291 322 }