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

Update redirect/cancel URIs for repository dialogs

Summary:
Ref T10923. Some of the dialogs ("Deactivate Repository", "Test Automation", etc.) had cancel or redirect URIs which I missed originally.

Go through them and make sure they all point to the right places.

Also removed one unused controller which I missed the first time around.

Test Plan:
- Opened all these dialogs in a new tab with Command-Click.
- Clicked every "cancel" and "submit" button on all of these dialogs.
- Got consistently sent to the place I came from.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10923

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

+55 -167
-2
src/__phutil_library_map__.php
··· 774 774 'DiffusionRepositoryStagingManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php', 775 775 'DiffusionRepositoryStatusManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php', 776 776 'DiffusionRepositoryStorageManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php', 777 - 'DiffusionRepositorySymbolsController' => 'applications/diffusion/controller/DiffusionRepositorySymbolsController.php', 778 777 'DiffusionRepositorySymbolsManagementPanel' => 'applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php', 779 778 'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php', 780 779 'DiffusionRepositoryTestAutomationController' => 'applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php', ··· 4994 4993 'DiffusionRepositoryStagingManagementPanel' => 'DiffusionRepositoryManagementPanel', 4995 4994 'DiffusionRepositoryStatusManagementPanel' => 'DiffusionRepositoryManagementPanel', 4996 4995 'DiffusionRepositoryStorageManagementPanel' => 'DiffusionRepositoryManagementPanel', 4997 - 'DiffusionRepositorySymbolsController' => 'DiffusionRepositoryEditController', 4998 4996 'DiffusionRepositorySymbolsManagementPanel' => 'DiffusionRepositoryManagementPanel', 4999 4997 'DiffusionRepositoryTag' => 'Phobject', 5000 4998 'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryEditController',
+16 -14
src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php
··· 13 13 $drequest = $this->getDiffusionRequest(); 14 14 $repository = $drequest->getRepository(); 15 15 16 - $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); 16 + $panel_uri = id(new DiffusionRepositoryBasicsManagementPanel()) 17 + ->setRepository($repository) 18 + ->getPanelURI(); 17 19 18 20 if ($request->isFormPost()) { 19 21 if (!$repository->isTracked()) { ··· 33 35 ->setActor($viewer) 34 36 ->applyTransactions($repository, array($xaction)); 35 37 36 - return id(new AphrontReloadResponse())->setURI($edit_uri); 38 + return id(new AphrontReloadResponse())->setURI($panel_uri); 37 39 } 38 40 39 41 if ($repository->isTracked()) { 40 - return $this->newDialog() 41 - ->setTitle(pht('Deactivate Repository?')) 42 - ->appendChild( 43 - pht('Deactivate this repository?')) 44 - ->addSubmitButton(pht('Deactivate Repository')) 45 - ->addCancelButton($edit_uri); 42 + $title = pht('Deactivate Repository'); 43 + $body = pht('Deactivate this repository?'); 44 + $submit = pht('Deactivate Repository'); 46 45 } else { 47 - return $this->newDialog() 48 - ->setTitle(pht('Activate Repository?')) 49 - ->appendChild( 50 - pht('Activate this repository?')) 51 - ->addSubmitButton(pht('Activate Repository')) 52 - ->addCancelButton($edit_uri); 46 + $title = pht('Activate Repository'); 47 + $body = pht('Activate this repository?'); 48 + $submit = pht('Activate Repository'); 53 49 } 50 + 51 + return $this->newDialog() 52 + ->setTitle($title) 53 + ->appendChild($body) 54 + ->addSubmitButton($submit) 55 + ->addCancelButton($panel_uri); 54 56 } 55 57 56 58 }
+25 -23
src/applications/diffusion/controller/DiffusionRepositoryEditDangerousController.php
··· 13 13 $drequest = $this->getDiffusionRequest(); 14 14 $repository = $drequest->getRepository(); 15 15 16 - $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); 16 + $panel_uri = id(new DiffusionRepositoryBasicsManagementPanel()) 17 + ->setRepository($repository) 18 + ->getPanelURI(); 17 19 18 20 if (!$repository->canAllowDangerousChanges()) { 19 21 if ($repository->isSVN()) { ··· 24 26 'It is not possible for users to push any dangerous changes '. 25 27 'to a Subversion repository. Pushes to a Subversion repository '. 26 28 'can always be reverted and never destroy data.')) 27 - ->addCancelButton($edit_uri); 29 + ->addCancelButton($panel_uri); 28 30 } else { 29 31 return $this->newDialog() 30 32 ->setTitle(pht('Unprotectable Repository')) ··· 33 35 'This repository can not be protected from dangerous changes '. 34 36 'because Phabricator does not control what users are allowed '. 35 37 'to push to it.')) 36 - ->addCancelButton($edit_uri); 38 + ->addCancelButton($panel_uri); 37 39 } 38 40 } 39 41 ··· 48 50 ->setActor($viewer) 49 51 ->applyTransactions($repository, array($xaction)); 50 52 51 - return id(new AphrontReloadResponse())->setURI($edit_uri); 53 + return id(new AphrontReloadResponse())->setURI($panel_uri); 52 54 } 53 55 54 56 $force = phutil_tag('tt', array(), '--force'); 55 57 56 58 if ($repository->shouldAllowDangerousChanges()) { 57 - return $this->newDialog() 58 - ->setTitle(pht('Prevent Dangerous changes?')) 59 - ->appendChild( 60 - pht( 61 - 'It will no longer be possible to delete branches from this '. 62 - 'repository, or %s push to this repository.', 63 - $force)) 64 - ->addSubmitButton(pht('Prevent Dangerous Changes')) 65 - ->addCancelButton($edit_uri); 59 + $title = pht('Prevent Dangerous Changes'); 60 + $body = pht( 61 + 'It will no longer be possible to delete branches from this '. 62 + 'repository, or %s push to this repository.', 63 + $force); 64 + $submit = pht('Prevent Dangerous Changes'); 66 65 } else { 67 - return $this->newDialog() 68 - ->setTitle(pht('Allow Dangerous Changes?')) 69 - ->appendChild( 70 - pht( 71 - 'If you allow dangerous changes, it will be possible to delete '. 72 - 'branches and %s push this repository. These operations can '. 73 - 'alter a repository in a way that is difficult to recover from.', 74 - $force)) 75 - ->addSubmitButton(pht('Allow Dangerous Changes')) 76 - ->addCancelButton($edit_uri); 66 + $title = pht('Allow Dangerous Changes'); 67 + $body = pht( 68 + 'If you allow dangerous changes, it will be possible to delete '. 69 + 'branches and %s push this repository. These operations can '. 70 + 'alter a repository in a way that is difficult to recover from.', 71 + $force); 72 + $submit = pht('Allow Dangerous Changes'); 77 73 } 74 + 75 + return $this->newDialog() 76 + ->setTitle($title) 77 + ->appendParagraph($body) 78 + ->addSubmitButton($submit) 79 + ->addCancelButton($panel_uri); 78 80 } 79 81 80 82 }
+4 -2
src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php
··· 13 13 $drequest = $this->getDiffusionRequest(); 14 14 $repository = $drequest->getRepository(); 15 15 16 - $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); 16 + $panel_uri = id(new DiffusionRepositoryBasicsManagementPanel()) 17 + ->setRepository($repository) 18 + ->getPanelURI(); 17 19 18 20 $dialog = new AphrontDialogView(); 19 21 $text_1 = pht( ··· 40 42 return $this->newDialog() 41 43 ->setTitle(pht('Really want to delete the repository?')) 42 44 ->appendChild($body) 43 - ->addCancelButton($edit_uri, pht('Okay')); 45 + ->addCancelButton($panel_uri, pht('Okay')); 44 46 } 45 47 46 48 }
+5 -3
src/applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php
··· 13 13 $drequest = $this->getDiffusionRequest(); 14 14 $repository = $drequest->getRepository(); 15 15 16 - $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); 16 + $panel_uri = id(new DiffusionRepositoryStatusManagementPanel()) 17 + ->setRepository($repository) 18 + ->getPanelURI(); 17 19 18 20 if ($request->isFormPost()) { 19 21 $params = array( ··· 26 28 ->setUser($viewer) 27 29 ->execute(); 28 30 29 - return id(new AphrontRedirectResponse())->setURI($edit_uri); 31 + return id(new AphrontRedirectResponse())->setURI($panel_uri); 30 32 } 31 33 32 34 $doc_name = 'Diffusion User Guide: Repository Updates'; ··· 58 60 'To learn more about how Phabricator updates repositories, '. 59 61 'read %s in the documentation.', 60 62 $doc_link)) 61 - ->addCancelButton($edit_uri) 63 + ->addCancelButton($panel_uri) 62 64 ->addSubmitButton(pht('Schedule Update')); 63 65 } 64 66
-120
src/applications/diffusion/controller/DiffusionRepositorySymbolsController.php
··· 1 - <?php 2 - 3 - final class DiffusionRepositorySymbolsController 4 - extends DiffusionRepositoryEditController { 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 - $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); 17 - 18 - $v_sources = $repository->getSymbolSources(); 19 - $v_languages = $repository->getSymbolLanguages(); 20 - if ($v_languages) { 21 - $v_languages = implode(', ', $v_languages); 22 - } 23 - $errors = array(); 24 - 25 - if ($request->isFormPost()) { 26 - $v_sources = $request->getArr('sources'); 27 - $v_languages = $request->getStrList('languages'); 28 - $v_languages = array_map('phutil_utf8_strtolower', $v_languages); 29 - 30 - if (!$errors) { 31 - $xactions = array(); 32 - $template = id(new PhabricatorRepositoryTransaction()); 33 - 34 - $type_sources = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES; 35 - $type_lang = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE; 36 - 37 - $xactions[] = id(clone $template) 38 - ->setTransactionType($type_sources) 39 - ->setNewValue($v_sources); 40 - 41 - $xactions[] = id(clone $template) 42 - ->setTransactionType($type_lang) 43 - ->setNewValue($v_languages); 44 - 45 - try { 46 - id(new PhabricatorRepositoryEditor()) 47 - ->setContinueOnNoEffect(true) 48 - ->setContentSourceFromRequest($request) 49 - ->setActor($viewer) 50 - ->applyTransactions($repository, $xactions); 51 - 52 - return id(new AphrontRedirectResponse())->setURI($edit_uri); 53 - } catch (Exception $ex) { 54 - $errors[] = $ex->getMessage(); 55 - } 56 - } 57 - } 58 - 59 - $crumbs = $this->buildApplicationCrumbs(); 60 - $crumbs->addTextCrumb(pht('Edit Symbols')); 61 - 62 - $title = pht('Edit Symbols (%s)', $repository->getName()); 63 - $header = id(new PHUIHeaderView()) 64 - ->setHeader($title) 65 - ->setHeaderIcon('fa-pencil'); 66 - 67 - $form = id(new AphrontFormView()) 68 - ->setUser($viewer) 69 - ->appendRemarkupInstructions($this->getInstructions()) 70 - ->appendChild( 71 - id(new AphrontFormTextControl()) 72 - ->setName('languages') 73 - ->setLabel(pht('Indexed Languages')) 74 - ->setCaption(pht( 75 - 'File extensions, separate with commas, for example: php, py. '. 76 - 'Leave blank for "any".')) 77 - ->setValue($v_languages)) 78 - 79 - ->appendControl( 80 - id(new AphrontFormTokenizerControl()) 81 - ->setName('sources') 82 - ->setLabel(pht('Uses Symbols From')) 83 - ->setDatasource(new DiffusionRepositoryDatasource()) 84 - ->setValue($v_sources)) 85 - 86 - ->appendChild( 87 - id(new AphrontFormSubmitControl()) 88 - ->setValue(pht('Save')) 89 - ->addCancelButton($edit_uri)); 90 - 91 - $form_box = id(new PHUIObjectBoxView()) 92 - ->setHeaderText(pht('Symbols')) 93 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 94 - ->setForm($form) 95 - ->setFormErrors($errors); 96 - 97 - $view = id(new PHUITwoColumnView()) 98 - ->setHeader($header) 99 - ->setFooter(array( 100 - $form_box, 101 - )); 102 - 103 - return $this->newPage() 104 - ->setTitle($title) 105 - ->setCrumbs($crumbs) 106 - ->appendChild($view); 107 - } 108 - 109 - private function getInstructions() { 110 - return pht(<<<EOT 111 - Configure Symbols for this repository. 112 - 113 - See [[%s | Symbol Indexes]] for more information on using symbols. 114 - EOT 115 - , 116 - PhabricatorEnv::getDoclink( 117 - 'Diffusion User Guide: Symbol Indexes')); 118 - } 119 - 120 - }
+5 -3
src/applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php
··· 13 13 $drequest = $this->getDiffusionRequest(); 14 14 $repository = $drequest->getRepository(); 15 15 16 - $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); 16 + $panel_uri = id(new DiffusionRepositoryAutomationManagementPanel()) 17 + ->setRepository($repository) 18 + ->getPanelURI(); 17 19 18 20 if (!$repository->canPerformAutomation()) { 19 21 return $this->newDialog() ··· 23 25 'You can not run a configuration test for this repository '. 24 26 'because you have not configured repository automation yet. '. 25 27 'Configure it first, then test the configuration.')) 26 - ->addCancelButton($edit_uri); 28 + ->addCancelButton($panel_uri); 27 29 } 28 30 29 31 if ($request->isFormPost()) { ··· 63 65 'If you run into write failures despite passing this test, '. 64 66 'it suggests that your setup is nearly correct but authentication '. 65 67 'is probably not fully configured.')) 66 - ->addCancelButton($edit_uri) 68 + ->addCancelButton($panel_uri) 67 69 ->addSubmitButton(pht('Start Test')); 68 70 } 69 71