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

Port "Actions" to new Repository UI

Summary: Ref T10748. This brings the "Actions" items (publish/notify + autoclose enabled) into the new UI.

Test Plan:
- Edited this stuff via EditEngine and Conduit.
- Viewed via new Manage UI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10748

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

+119 -8
+2
src/__phutil_library_map__.php
··· 743 743 'DiffusionRefTableController' => 'applications/diffusion/controller/DiffusionRefTableController.php', 744 744 'DiffusionRefsQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php', 745 745 'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php', 746 + 'DiffusionRepositoryActionsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php', 746 747 'DiffusionRepositoryAutomationManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php', 747 748 'DiffusionRepositoryBasicsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php', 748 749 'DiffusionRepositoryBranchesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php', ··· 4963 4964 'DiffusionRefTableController' => 'DiffusionController', 4964 4965 'DiffusionRefsQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', 4965 4966 'DiffusionRenameHistoryQuery' => 'Phobject', 4967 + 'DiffusionRepositoryActionsManagementPanel' => 'DiffusionRepositoryManagementPanel', 4966 4968 'DiffusionRepositoryAutomationManagementPanel' => 'DiffusionRepositoryManagementPanel', 4967 4969 'DiffusionRepositoryBasicsManagementPanel' => 'DiffusionRepositoryManagementPanel', 4968 4970 'DiffusionRepositoryBranchesManagementPanel' => 'DiffusionRepositoryManagementPanel',
+29
src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
··· 143 143 ->setLabel(pht('Allow Dangerous Changes')) 144 144 ->setIsCopyable(true) 145 145 ->setIsConduitOnly(true) 146 + ->setOptions( 147 + pht('Prevent Dangerous Changes'), 148 + pht('Allow Dangerous Changes')) 146 149 ->setTransactionType(PhabricatorRepositoryTransaction::TYPE_DANGEROUS) 147 150 ->setDescription(pht('Permit dangerous changes to be made.')) 148 151 ->setConduitDescription(pht('Allow or prevent dangerous changes.')) ··· 235 238 ->setConduitDescription(pht('Change symbol source repositories.')) 236 239 ->setConduitTypeDescription(pht('New symbol repositories.')) 237 240 ->setValue($object->getSymbolSources()), 241 + id(new PhabricatorBoolEditField()) 242 + ->setKey('publish') 243 + ->setLabel(pht('Publish/Notify')) 244 + ->setTransactionType( 245 + PhabricatorRepositoryTransaction::TYPE_NOTIFY) 246 + ->setIsCopyable(true) 247 + ->setOptions( 248 + pht('Disable Notifications, Feed, and Herald'), 249 + pht('Enable Notifications, Feed, and Herald')) 250 + ->setDescription(pht('Configure how changes are published.')) 251 + ->setConduitDescription(pht('Change publishing options.')) 252 + ->setConduitTypeDescription(pht('New notification setting.')) 253 + ->setValue(!$object->getDetail('herald-disabled')), 254 + id(new PhabricatorBoolEditField()) 255 + ->setKey('autoclose') 256 + ->setLabel(pht('Autoclose')) 257 + ->setTransactionType( 258 + PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE) 259 + ->setIsCopyable(true) 260 + ->setOptions( 261 + pht('Disable Autoclose'), 262 + pht('Enable Autoclose')) 263 + ->setDescription(pht('Stop or resume autoclosing in this repository.')) 264 + ->setConduitDescription(pht('Change autoclose setting.')) 265 + ->setConduitTypeDescription(pht('New autoclose setting.')) 266 + ->setValue(!$object->getDetail('disable-autoclose')), 238 267 id(new PhabricatorPolicyEditField()) 239 268 ->setKey('policy.push') 240 269 ->setLabel(pht('Push Policy'))
+60
src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php
··· 1 + <?php 2 + 3 + final class DiffusionRepositoryActionsManagementPanel 4 + extends DiffusionRepositoryManagementPanel { 5 + 6 + const PANELKEY = 'actions'; 7 + 8 + public function getManagementPanelLabel() { 9 + return pht('Actions'); 10 + } 11 + 12 + public function getManagementPanelOrder() { 13 + return 1100; 14 + } 15 + 16 + protected function buildManagementPanelActions() { 17 + $repository = $this->getRepository(); 18 + $viewer = $this->getViewer(); 19 + 20 + $can_edit = PhabricatorPolicyFilter::hasCapability( 21 + $viewer, 22 + $repository, 23 + PhabricatorPolicyCapability::CAN_EDIT); 24 + 25 + $actions_uri = $repository->getPathURI('edit/actions/'); 26 + 27 + return array( 28 + id(new PhabricatorActionView()) 29 + ->setIcon('fa-pencil') 30 + ->setName(pht('Edit Actions')) 31 + ->setHref($actions_uri) 32 + ->setDisabled(!$can_edit) 33 + ->setWorkflow(!$can_edit), 34 + ); 35 + } 36 + 37 + public function buildManagementPanelContent() { 38 + $repository = $this->getRepository(); 39 + $viewer = $this->getViewer(); 40 + 41 + $view = id(new PHUIPropertyListView()) 42 + ->setViewer($viewer) 43 + ->setActionList($this->newActions()); 44 + 45 + $notify = $repository->getDetail('herald-disabled') 46 + ? pht('Off') 47 + : pht('On'); 48 + $notify = phutil_tag('em', array(), $notify); 49 + $view->addProperty(pht('Publish/Notify'), $notify); 50 + 51 + $autoclose = $repository->getDetail('disable-autoclose') 52 + ? pht('Off') 53 + : pht('On'); 54 + $autoclose = phutil_tag('em', array(), $autoclose); 55 + $view->addProperty(pht('Autoclose'), $autoclose); 56 + 57 + return $this->newBox(pht('Branches'), $view); 58 + } 59 + 60 + }
+1 -1
src/applications/repository/editor/PhabricatorRepositoryEditor.php
··· 342 342 $errors = parent::validateTransaction($object, $type, $xactions); 343 343 344 344 switch ($type) { 345 - case PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE: 345 + case PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE_ONLY: 346 346 case PhabricatorRepositoryTransaction::TYPE_TRACK_ONLY: 347 347 foreach ($xactions as $xaction) { 348 348 foreach ($xaction->getNewValue() as $pattern) {
+3 -2
src/applications/transactions/editengine/PhabricatorEditEngine.php
··· 1808 1808 } catch (Exception $ex) { 1809 1809 throw new PhutilProxyException( 1810 1810 pht( 1811 - 'Exception when processing transaction of type "%s".', 1812 - $xaction['type']), 1811 + 'Exception when processing transaction of type "%s": %s', 1812 + $xaction['type'], 1813 + $ex->getMessage()), 1813 1814 $ex); 1814 1815 } 1815 1816
+24 -5
src/applications/transactions/editfield/PhabricatorBoolEditField.php
··· 3 3 final class PhabricatorBoolEditField 4 4 extends PhabricatorEditField { 5 5 6 + private $options; 7 + 8 + public function setOptions($off_label, $on_label) { 9 + $this->options = array( 10 + '0' => $off_label, 11 + '1' => $on_label, 12 + ); 13 + return $this; 14 + } 15 + 16 + public function getOptions() { 17 + return $this->options; 18 + } 19 + 6 20 protected function newControl() { 21 + $options = $this->getOptions(); 22 + 23 + if (!$options) { 24 + $options = array( 25 + '0' => pht('False'), 26 + '1' => pht('True'), 27 + ); 28 + } 29 + 7 30 return id(new AphrontFormSelectControl()) 8 - ->setOptions( 9 - array( 10 - '0' => pht('False'), 11 - '1' => pht('True'), 12 - )); 31 + ->setOptions($options); 13 32 } 14 33 15 34 protected function newHTTPParameterType() {