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

Allow dashboard panel policies to be edited

Summary: Fixes T4982, expose dashboard panel policy editing to UI

Test Plan: Create panel, verify that user can edit who can see and who can edit panel

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T4982

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

authored by

lkassianik and committed by
epriestley
953f9505 5e905eda

+38 -2
+36 -2
src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php
··· 66 66 ->readFieldsFromStorage($panel); 67 67 68 68 $validation_exception = null; 69 + 69 70 if ($request->isFormPost()) { 70 71 $v_name = $request->getStr('name'); 72 + $v_view_policy = $request->getStr('viewPolicy'); 73 + $v_edit_policy = $request->getStr('editPolicy'); 74 + 75 + $type_name = PhabricatorDashboardPanelTransaction::TYPE_NAME; 76 + $type_view_policy = PhabricatorTransactions::TYPE_VIEW_POLICY; 77 + $type_edit_policy = PhabricatorTransactions::TYPE_EDIT_POLICY; 71 78 72 79 $xactions = array(); 73 80 74 - $type_name = PhabricatorDashboardPanelTransaction::TYPE_NAME; 75 81 $xactions[] = id(new PhabricatorDashboardPanelTransaction()) 76 82 ->setTransactionType($type_name) 77 83 ->setNewValue($v_name); 78 84 85 + $xactions[] = id(new PhabricatorDashboardPanelTransaction()) 86 + ->setTransactionType($type_view_policy) 87 + ->setNewValue($v_view_policy); 88 + 89 + $xactions[] = id(new PhabricatorDashboardPanelTransaction()) 90 + ->setTransactionType($type_edit_policy) 91 + ->setNewValue($v_edit_policy); 92 + 79 93 $field_xactions = $field_list->buildFieldTransactionsFromRequest( 80 94 new PhabricatorDashboardPanelTransaction(), 81 95 $request); ··· 94 108 $validation_exception = $ex; 95 109 96 110 $e_name = $validation_exception->getShortMessage($type_name); 111 + 112 + $panel->setViewPolicy($v_view_policy); 113 + $panel->setEditPolicy($v_edit_policy); 97 114 } 98 115 } 99 116 117 + $policies = id(new PhabricatorPolicyQuery()) 118 + ->setViewer($viewer) 119 + ->setObject($panel) 120 + ->execute(); 121 + 100 122 $form = id(new AphrontFormView()) 101 123 ->setUser($viewer) 102 124 ->appendChild( ··· 104 126 ->setLabel(pht('Name')) 105 127 ->setName('name') 106 128 ->setValue($v_name) 107 - ->setError($e_name)); 129 + ->setError($e_name)) 130 + ->appendChild( 131 + id(new AphrontFormPolicyControl()) 132 + ->setName('viewPolicy') 133 + ->setPolicyObject($panel) 134 + ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) 135 + ->setPolicies($policies)) 136 + ->appendChild( 137 + id(new AphrontFormPolicyControl()) 138 + ->setName('editPolicy') 139 + ->setPolicyObject($panel) 140 + ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) 141 + ->setPolicies($policies)); 108 142 109 143 $field_list->appendFieldsToForm($form); 110 144
+2
src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php
··· 63 63 64 64 switch ($xaction->getTransactionType()) { 65 65 case PhabricatorDashboardPanelTransaction::TYPE_NAME: 66 + case PhabricatorTransactions::TYPE_VIEW_POLICY: 67 + case PhabricatorTransactions::TYPE_EDIT_POLICY: 66 68 return; 67 69 } 68 70