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

at recaptime-dev/main 80 lines 2.5 kB view raw
1<?php 2 3final class PhortuneAccountAddManagerController 4 extends PhortuneAccountController { 5 6 protected function shouldRequireAccountEditCapability() { 7 return true; 8 } 9 10 protected function handleAccountRequest(AphrontRequest $request) { 11 $viewer = $request->getViewer(); 12 $account = $this->getAccount(); 13 14 $id = $account->getID(); 15 16 $v_managers = array(); 17 $e_managers = null; 18 $account_uri = $this->getApplicationURI("/account/{$id}/managers/"); 19 20 if ($request->isFormPost()) { 21 $xactions = array(); 22 $v_managers = $request->getArr('managerPHIDs'); 23 $type_edge = PhabricatorTransactions::TYPE_EDGE; 24 25 $xactions[] = id(new PhortuneAccountTransaction()) 26 ->setTransactionType($type_edge) 27 ->setMetadataValue( 28 'edge:type', 29 PhortuneAccountHasMemberEdgeType::EDGECONST) 30 ->setNewValue( 31 array( 32 '+' => array_fuse($v_managers), 33 )); 34 35 $editor = id(new PhortuneAccountEditor()) 36 ->setActor($viewer) 37 ->setContentSourceFromRequest($request) 38 ->setContinueOnNoEffect(true); 39 40 try { 41 $editor->applyTransactions($account, $xactions); 42 43 return id(new AphrontRedirectResponse())->setURI($account_uri); 44 } catch (PhabricatorApplicationTransactionValidationException $ex) { 45 $validation_exception = $ex; 46 $e_managers = $ex->getShortMessage($type_edge); 47 } 48 } 49 50 $account_phid = $account->getPHID(); 51 $handles = $viewer->loadHandles(array($account_phid)); 52 $handle = $handles[$account_phid]; 53 54 $form = id(new AphrontFormView()) 55 ->setViewer($viewer) 56 ->appendInstructions( 57 pht( 58 'Choose one or more users to add as account managers. Managers '. 59 'have full control of the account.')) 60 ->appendControl( 61 id(new AphrontFormStaticControl()) 62 ->setLabel(pht('Payment Account')) 63 ->setValue($handle->renderLink())) 64 ->appendControl( 65 id(new AphrontFormTokenizerControl()) 66 ->setDatasource(new PhabricatorPeopleDatasource()) 67 ->setLabel(pht('Add Managers')) 68 ->setName('managerPHIDs') 69 ->setValue($v_managers) 70 ->setError($e_managers)); 71 72 return $this->newDialog() 73 ->setTitle(pht('Add New Managers')) 74 ->appendForm($form) 75 ->setWidth(AphrontDialogView::WIDTH_FORM) 76 ->addCancelButton($account_uri) 77 ->addSubmitButton(pht('Add Managers')); 78 } 79 80}