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

Ship "Repositories" create button to new Diffusion workflow

Summary: Ref T2231. Get rid of the old create controller and make the button go to the new stuff instead. This will eventually get cleaned up more, but I don't have a clear plan for Arcanist Projects yet.

Test Plan: Clicked button, hit new workflow.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2231

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

+1 -122
-2
src/applications/repository/application/PhabricatorApplicationRepositories.php
··· 29 29 return array( 30 30 '/repository/' => array( 31 31 '' => 'PhabricatorRepositoryListController', 32 - 'create/' => 'PhabricatorRepositoryCreateController', 33 - 'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorRepositoryDeleteController', 34 32 'project/edit/(?P<id>[1-9]\d*)/' => 35 33 'PhabricatorRepositoryArcanistProjectEditController', 36 34 'project/delete/(?P<id>[1-9]\d*)/' =>
-119
src/applications/repository/controller/PhabricatorRepositoryCreateController.php
··· 1 - <?php 2 - 3 - final class PhabricatorRepositoryCreateController 4 - extends PhabricatorRepositoryController { 5 - 6 - public function processRequest() { 7 - 8 - 9 - $request = $this->getRequest(); 10 - $user = $request->getUser(); 11 - 12 - $e_name = true; 13 - $e_callsign = true; 14 - 15 - $repository = new PhabricatorRepository(); 16 - 17 - $type_map = PhabricatorRepositoryType::getAllRepositoryTypes(); 18 - $errors = array(); 19 - 20 - if ($request->isFormPost()) { 21 - 22 - $repository->setName($request->getStr('name')); 23 - $repository->setCallsign($request->getStr('callsign')); 24 - $repository->setVersionControlSystem($request->getStr('type')); 25 - 26 - if (!strlen($repository->getName())) { 27 - $e_name = 'Required'; 28 - $errors[] = 'Repository name is required.'; 29 - } else { 30 - $e_name = null; 31 - } 32 - 33 - if (!strlen($repository->getCallsign())) { 34 - $e_callsign = 'Required'; 35 - $errors[] = 'Callsign is required.'; 36 - } else if (!preg_match('/^[A-Z]+$/', $repository->getCallsign())) { 37 - $e_callsign = 'Invalid'; 38 - $errors[] = 'Callsign must be ALL UPPERCASE LETTERS.'; 39 - } else { 40 - $e_callsign = null; 41 - } 42 - 43 - if (empty($type_map[$repository->getVersionControlSystem()])) { 44 - $errors[] = 'Invalid version control system.'; 45 - } 46 - 47 - if (!$errors) { 48 - try { 49 - $repository->save(); 50 - 51 - return id(new AphrontRedirectResponse()) 52 - ->setURI('/repository/edit/'.$repository->getID().'/'); 53 - 54 - } catch (AphrontQueryDuplicateKeyException $ex) { 55 - $e_callsign = 'Duplicate'; 56 - $errors[] = 'Callsign must be unique. Another repository already '. 57 - 'uses that callsign.'; 58 - } 59 - } 60 - } 61 - 62 - $error_view = null; 63 - if ($errors) { 64 - $error_view = new AphrontErrorView(); 65 - $error_view->setErrors($errors); 66 - $error_view->setTitle('Form Errors'); 67 - } 68 - 69 - $form = new AphrontFormView(); 70 - $form 71 - ->setUser($user) 72 - ->setAction('/repository/create/') 73 - ->appendChild( 74 - id(new AphrontFormTextControl()) 75 - ->setLabel('Name') 76 - ->setName('name') 77 - ->setValue($repository->getName()) 78 - ->setError($e_name) 79 - ->setCaption('Human-readable repository name.')) 80 - ->appendChild(hsprintf( 81 - '<p class="aphront-form-instructions">Select a "Callsign" &mdash; a '. 82 - 'short, uppercase string to identify revisions in this repository. If '. 83 - 'you choose "EX", revisions in this repository will be identified '. 84 - 'with the prefix "rEX".</p>')) 85 - ->appendChild( 86 - id(new AphrontFormTextControl()) 87 - ->setLabel('Callsign') 88 - ->setName('callsign') 89 - ->setValue($repository->getCallsign()) 90 - ->setError($e_callsign) 91 - ->setCaption( 92 - 'Short, UPPERCASE identifier. Once set, it can not be changed.')) 93 - ->appendChild( 94 - id(new AphrontFormSelectControl()) 95 - ->setLabel('Type') 96 - ->setName('type') 97 - ->setOptions($type_map) 98 - ->setValue($repository->getVersionControlSystem())) 99 - ->appendChild( 100 - id(new AphrontFormSubmitControl()) 101 - ->setValue('Create Repository') 102 - ->addCancelButton('/repository/')); 103 - 104 - $form_box = id(new PHUIObjectBoxView()) 105 - ->setHeaderText(pht('Create Repository')) 106 - ->setFormError($error_view) 107 - ->setForm($form); 108 - 109 - return $this->buildApplicationPage( 110 - array( 111 - $form_box, 112 - ), 113 - array( 114 - 'title' => pht('Create Repository'), 115 - 'device' => true, 116 - )); 117 - } 118 - 119 - }
+1 -1
src/applications/repository/controller/PhabricatorRepositoryListController.php
··· 74 74 $panel = new AphrontPanelView(); 75 75 $panel->setHeader('Repositories'); 76 76 if ($is_admin) { 77 - $panel->setCreateButton('Create New Repository', '/repository/create/'); 77 + $panel->setCreateButton('Create New Repository', '/diffusion/create/'); 78 78 } 79 79 $panel->appendChild($table); 80 80 $panel->setNoBackground();