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

Move the repository "Publishing" option to the "Basics" panel in repository management

Summary:
Depends on D20424. Ref T13277. Now that the "Actions" panel only has one item ("Publishing"), just move it to the "Basics" panel.

Update the UI to show active/publishing status more clearly and relate them to one another and importing state.

Test Plan: {F6378087}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13277

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

+191 -78
+2 -2
src/__phutil_library_map__.php
··· 951 951 'DiffusionRepositoryEditDeleteController' => 'applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php', 952 952 'DiffusionRepositoryEditEngine' => 'applications/diffusion/editor/DiffusionRepositoryEditEngine.php', 953 953 'DiffusionRepositoryEditEnormousController' => 'applications/diffusion/controller/DiffusionRepositoryEditEnormousController.php', 954 + 'DiffusionRepositoryEditPublishingController' => 'applications/diffusion/controller/DiffusionRepositoryEditPublishingController.php', 954 955 'DiffusionRepositoryEditUpdateController' => 'applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php', 955 956 'DiffusionRepositoryFunctionDatasource' => 'applications/diffusion/typeahead/DiffusionRepositoryFunctionDatasource.php', 956 957 'DiffusionRepositoryHistoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryHistoryManagementPanel.php', ··· 969 970 'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php', 970 971 'DiffusionRepositoryPoliciesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php', 971 972 'DiffusionRepositoryProfilePictureController' => 'applications/diffusion/controller/DiffusionRepositoryProfilePictureController.php', 972 - 'DiffusionRepositoryPublishingManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryPublishingManagementPanel.php', 973 973 'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php', 974 974 'DiffusionRepositoryRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryRemarkupRule.php', 975 975 'DiffusionRepositorySearchConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRepositorySearchConduitAPIMethod.php', ··· 6602 6602 'DiffusionRepositoryEditDeleteController' => 'DiffusionRepositoryManageController', 6603 6603 'DiffusionRepositoryEditEngine' => 'PhabricatorEditEngine', 6604 6604 'DiffusionRepositoryEditEnormousController' => 'DiffusionRepositoryManageController', 6605 + 'DiffusionRepositoryEditPublishingController' => 'DiffusionRepositoryManageController', 6605 6606 'DiffusionRepositoryEditUpdateController' => 'DiffusionRepositoryManageController', 6606 6607 'DiffusionRepositoryFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 6607 6608 'DiffusionRepositoryHistoryManagementPanel' => 'DiffusionRepositoryManagementPanel', ··· 6620 6621 'DiffusionRepositoryPath' => 'Phobject', 6621 6622 'DiffusionRepositoryPoliciesManagementPanel' => 'DiffusionRepositoryManagementPanel', 6622 6623 'DiffusionRepositoryProfilePictureController' => 'DiffusionController', 6623 - 'DiffusionRepositoryPublishingManagementPanel' => 'DiffusionRepositoryManagementPanel', 6624 6624 'DiffusionRepositoryRef' => 'Phobject', 6625 6625 'DiffusionRepositoryRemarkupRule' => 'PhabricatorObjectRemarkupRule', 6626 6626 'DiffusionRepositorySearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
+1
src/applications/diffusion/application/PhabricatorDiffusionApplication.php
··· 86 86 'enormous/' => 'DiffusionRepositoryEditEnormousController', 87 87 'delete/' => 'DiffusionRepositoryEditDeleteController', 88 88 'update/' => 'DiffusionRepositoryEditUpdateController', 89 + 'publish/' => 'DiffusionRepositoryEditPublishingController', 89 90 'testautomation/' => 'DiffusionRepositoryTestAutomationController', 90 91 ), 91 92 'pathtree/(?P<dblob>.*)' => 'DiffusionPathTreeController',
+2
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 334 334 'fa-clock-o', 335 335 'indigo', 336 336 pht('Importing (%s)...', $percentage)); 337 + } else if ($repository->isPublishingDisabled()) { 338 + $header->setStatus('fa-minus', 'bluegrey', pht('Publishing Disabled')); 337 339 } else { 338 340 $header->setStatus('fa-check', 'bluegrey', pht('Active')); 339 341 }
+83
src/applications/diffusion/controller/DiffusionRepositoryEditPublishingController.php
··· 1 + <?php 2 + 3 + final class DiffusionRepositoryEditPublishingController 4 + extends DiffusionRepositoryManageController { 5 + 6 + public function handleRequest(AphrontRequest $request) { 7 + $response = $this->loadDiffusionContextForEdit(); 8 + if ($response) { 9 + return $response; 10 + } 11 + 12 + $viewer = $this->getViewer(); 13 + $drequest = $this->getDiffusionRequest(); 14 + $repository = $drequest->getRepository(); 15 + 16 + $panel_uri = id(new DiffusionRepositoryBasicsManagementPanel()) 17 + ->setRepository($repository) 18 + ->getPanelURI(); 19 + 20 + if ($request->isFormPost()) { 21 + if ($repository->isPublishingDisabled()) { 22 + $new_status = true; 23 + } else { 24 + $new_status = false; 25 + } 26 + 27 + $xaction = id(new PhabricatorRepositoryTransaction()) 28 + ->setTransactionType( 29 + PhabricatorRepositoryNotifyTransaction::TRANSACTIONTYPE) 30 + ->setNewValue($new_status); 31 + 32 + $editor = id(new PhabricatorRepositoryEditor()) 33 + ->setContinueOnNoEffect(true) 34 + ->setContinueOnMissingFields(true) 35 + ->setContentSourceFromRequest($request) 36 + ->setActor($viewer) 37 + ->applyTransactions($repository, array($xaction)); 38 + 39 + return id(new AphrontReloadResponse())->setURI($panel_uri); 40 + } 41 + 42 + $body = array(); 43 + if (!$repository->isPublishingDisabled()) { 44 + $title = pht('Disable Publishing'); 45 + $body[] = pht( 46 + 'If you disable publishing for this repository, new commits '. 47 + 'will not: send email, publish feed stories, trigger audits, or '. 48 + 'trigger Herald.'); 49 + 50 + $body[] = pht( 51 + 'This option is most commonly used to temporarily allow a major '. 52 + 'repository maintenance operation (like a history rewrite) to '. 53 + 'occur with minimal disruption to users.'); 54 + 55 + $submit = pht('Disable Publishing'); 56 + } else { 57 + $title = pht('Reactivate Publishing'); 58 + $body[] = pht( 59 + 'If you reactivate publishing for this repository, new commits '. 60 + 'that become reachable from permanent refs will: send email, '. 61 + 'publish feed stories, trigger audits, and trigger Herald.'); 62 + 63 + $body[] = pht( 64 + 'Commits which became reachable from a permanent ref while '. 65 + 'publishing was disabled will not trigger these actions '. 66 + 'retroactively.'); 67 + 68 + $submit = pht('Reactivate Publishing'); 69 + } 70 + 71 + $dialog = $this->newDialog() 72 + ->setTitle($title) 73 + ->addSubmitButton($submit) 74 + ->addCancelButton($panel_uri); 75 + 76 + foreach ($body as $graph) { 77 + $dialog->appendParagraph($graph); 78 + } 79 + 80 + return $dialog; 81 + } 82 + 83 + }
+103 -2
src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
··· 46 46 $dangerous_uri = $repository->getPathURI('edit/dangerous/'); 47 47 $enormous_uri = $repository->getPathURI('edit/enormous/'); 48 48 $update_uri = $repository->getPathURI('edit/update/'); 49 + $publish_uri = $repository->getPathURI('edit/publish/'); 49 50 50 51 if ($repository->isTracked()) { 51 52 $activate_icon = 'fa-ban'; ··· 53 54 } else { 54 55 $activate_icon = 'fa-check'; 55 56 $activate_label = pht('Activate Repository'); 57 + } 58 + 59 + if (!$repository->isPublishingDisabled()) { 60 + $publish_icon = 'fa-ban'; 61 + $publish_label = pht('Disable Publishing'); 62 + } else { 63 + $publish_icon = 'fa-check'; 64 + $publish_label = pht('Enable Publishing'); 56 65 } 57 66 58 67 $should_dangerous = $repository->shouldAllowDangerousChanges(); ··· 111 120 112 121 $action_list->addAction( 113 122 id(new PhabricatorActionView()) 123 + ->setType(PhabricatorActionView::TYPE_DIVIDER)); 124 + 125 + $action_list->addAction( 126 + id(new PhabricatorActionView()) 114 127 ->setName($activate_label) 115 128 ->setHref($activate_uri) 116 129 ->setIcon($activate_icon) ··· 119 132 120 133 $action_list->addAction( 121 134 id(new PhabricatorActionView()) 135 + ->setName($publish_label) 136 + ->setHref($publish_uri) 137 + ->setIcon($publish_icon) 138 + ->setDisabled(!$can_edit) 139 + ->setWorkflow(true)); 140 + 141 + $action_list->addAction( 142 + id(new PhabricatorActionView()) 122 143 ->setName(pht('Update Now')) 123 144 ->setHref($update_uri) 124 145 ->setIcon('fa-refresh') ··· 147 168 $basics = $this->newBox(pht('Properties'), $basics); 148 169 149 170 $repository = $this->getRepository(); 171 + 172 + $state = $this->buildStateView($repository); 173 + 150 174 $is_new = $repository->isNewlyInitialized(); 151 175 $info_view = null; 152 176 if ($is_new) { ··· 180 204 } 181 205 $status = $this->buildStatus(); 182 206 183 - return array($info_view, $basics, $description, $status); 207 + return array($info_view, $state, $basics, $description, $status); 184 208 } 185 209 186 210 private function buildBasics() { ··· 287 311 $view->addTextContent($raw_error); 288 312 } 289 313 290 - return $this->newBox(pht('Status'), $view); 314 + return $this->newBox(pht('Working Copy Status'), $view); 291 315 } 292 316 293 317 private function buildRepositoryUpdateInterval( ··· 718 742 'href' => $config_href, 719 743 ), 720 744 'environment.append-paths'); 745 + } 746 + 747 + private function buildStateView(PhabricatorRepository $repository) { 748 + $viewer = $this->getViewer(); 749 + $is_new = $repository->isNewlyInitialized(); 750 + 751 + $view = id(new PHUIPropertyListView()) 752 + ->setViewer($viewer); 753 + 754 + if (!$repository->isTracked()) { 755 + if ($is_new) { 756 + $active_icon = 'fa-ban'; 757 + $active_color = 'yellow'; 758 + $active_label = pht('Not Activated Yet'); 759 + $active_note = pht('Complete Setup and Activate Repository'); 760 + } else { 761 + $active_icon = 'fa-times'; 762 + $active_color = 'red'; 763 + $active_label = pht('Not Active'); 764 + $active_note = pht('Repository Disabled'); 765 + } 766 + } else if ($repository->isImporting()) { 767 + $active_icon = 'fa-hourglass'; 768 + $active_color = 'yellow'; 769 + $active_label = pht('Importing...'); 770 + $active_note = null; 771 + } else { 772 + $active_icon = 'fa-check'; 773 + $active_color = 'green'; 774 + $active_label = pht('Repository Active'); 775 + $active_note = null; 776 + } 777 + 778 + $active_view = id(new PHUIStatusListView()) 779 + ->addItem( 780 + id(new PHUIStatusItemView()) 781 + ->setIcon($active_icon, $active_color) 782 + ->setTarget($active_label) 783 + ->setNote($active_note)); 784 + 785 + if ($repository->isPublishingDisabled()) { 786 + $publishing_icon = 'fa-times'; 787 + $publishing_color = 'red'; 788 + $publishing_label = pht('Not Publishing'); 789 + $publishing_note = pht('Publishing Disabled'); 790 + } else if (!$repository->isTracked()) { 791 + $publishing_icon = 'fa-ban'; 792 + $publishing_color = 'yellow'; 793 + $publishing_label = pht('Not Publishing'); 794 + if ($is_new) { 795 + $publishing_note = pht('Repository Not Active Yet'); 796 + } else { 797 + $publishing_note = pht('Repository Inactive'); 798 + } 799 + } else if ($repository->isImporting()) { 800 + $publishing_icon = 'fa-ban'; 801 + $publishing_color = 'yellow'; 802 + $publishing_label = pht('Not Publishing'); 803 + $publishing_note = pht('Repository Importing'); 804 + } else { 805 + $publishing_icon = 'fa-check'; 806 + $publishing_color = 'green'; 807 + $publishing_label = pht('Publishing Active'); 808 + $publishing_note = null; 809 + } 810 + 811 + $publishing_view = id(new PHUIStatusListView()) 812 + ->addItem( 813 + id(new PHUIStatusItemView()) 814 + ->setIcon($publishing_icon, $publishing_color) 815 + ->setTarget($publishing_label) 816 + ->setNote($publishing_note)); 817 + 818 + $view->addProperty(pht('Active'), $active_view); 819 + $view->addProperty(pht('Publishing'), $publishing_view); 820 + 821 + return $this->newBox(pht('State'), $view); 721 822 } 722 823 723 824 }
-74
src/applications/diffusion/management/DiffusionRepositoryPublishingManagementPanel.php
··· 1 - <?php 2 - 3 - final class DiffusionRepositoryPublishingManagementPanel 4 - extends DiffusionRepositoryManagementPanel { 5 - 6 - const PANELKEY = 'publishing'; 7 - 8 - public function getManagementPanelLabel() { 9 - return pht('Publishing'); 10 - } 11 - 12 - public function getManagementPanelOrder() { 13 - return 1100; 14 - } 15 - 16 - public function getManagementPanelIcon() { 17 - $repository = $this->getRepository(); 18 - 19 - $has_any = $repository->isPublishingDisabled(); 20 - 21 - if ($has_any) { 22 - return 'fa-flash'; 23 - } else { 24 - return 'fa-flash grey'; 25 - } 26 - } 27 - 28 - protected function getEditEngineFieldKeys() { 29 - return array( 30 - 'publish', 31 - ); 32 - } 33 - 34 - public function buildManagementPanelCurtain() { 35 - $repository = $this->getRepository(); 36 - $viewer = $this->getViewer(); 37 - $action_list = $this->newActionList(); 38 - 39 - $can_edit = PhabricatorPolicyFilter::hasCapability( 40 - $viewer, 41 - $repository, 42 - PhabricatorPolicyCapability::CAN_EDIT); 43 - 44 - $publishing_uri = $this->getEditPageURI(); 45 - 46 - $action_list->addAction( 47 - id(new PhabricatorActionView()) 48 - ->setIcon('fa-pencil') 49 - ->setName(pht('Edit Publishing')) 50 - ->setHref($publishing_uri) 51 - ->setDisabled(!$can_edit) 52 - ->setWorkflow(!$can_edit)); 53 - 54 - return $this->newCurtainView() 55 - ->setActionList($action_list); 56 - } 57 - 58 - public function buildManagementPanelContent() { 59 - $repository = $this->getRepository(); 60 - $viewer = $this->getViewer(); 61 - 62 - $view = id(new PHUIPropertyListView()) 63 - ->setViewer($viewer); 64 - 65 - $notify = $repository->isPublishingDisabled() 66 - ? pht('Off') 67 - : pht('On'); 68 - $notify = phutil_tag('em', array(), $notify); 69 - $view->addProperty(pht('Publishing'), $notify); 70 - 71 - return $this->newBox(pht('Publishing'), $view); 72 - } 73 - 74 - }