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

Merge some of the project editing options into an edit UI

Summary: Ref T4426. This moves "Edit Details", "Edit Picture", and "Archive" to a separate "Edit" interface. "History" becomes part of this UI.

Test Plan:
{F114417}

{F114418}

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T4426

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

+185 -123
+6 -6
src/__phutil_library_map__.php
··· 1844 1844 'PhabricatorProjectCustomFieldStringIndex' => 'applications/project/storage/PhabricatorProjectCustomFieldStringIndex.php', 1845 1845 'PhabricatorProjectDAO' => 'applications/project/storage/PhabricatorProjectDAO.php', 1846 1846 'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php', 1847 + 'PhabricatorProjectEditDetailsController' => 'applications/project/controller/PhabricatorProjectEditDetailsController.php', 1848 + 'PhabricatorProjectEditMainController' => 'applications/project/controller/PhabricatorProjectEditMainController.php', 1849 + 'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php', 1847 1850 'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php', 1848 - 'PhabricatorProjectHistoryController' => 'applications/project/controller/PhabricatorProjectHistoryController.php', 1849 1851 'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php', 1850 1852 'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php', 1851 1853 'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php', ··· 1853 1855 'PhabricatorProjectPHIDTypeColumn' => 'applications/project/phid/PhabricatorProjectPHIDTypeColumn.php', 1854 1856 'PhabricatorProjectPHIDTypeProject' => 'applications/project/phid/PhabricatorProjectPHIDTypeProject.php', 1855 1857 'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php', 1856 - 'PhabricatorProjectProfileEditController' => 'applications/project/controller/PhabricatorProjectProfileEditController.php', 1857 - 'PhabricatorProjectProfilePictureController' => 'applications/project/controller/PhabricatorProjectProfilePictureController.php', 1858 1858 'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php', 1859 1859 'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php', 1860 1860 'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php', ··· 4591 4591 'PhabricatorProjectCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage', 4592 4592 'PhabricatorProjectDAO' => 'PhabricatorLiskDAO', 4593 4593 'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField', 4594 + 'PhabricatorProjectEditDetailsController' => 'PhabricatorProjectController', 4595 + 'PhabricatorProjectEditMainController' => 'PhabricatorProjectController', 4596 + 'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController', 4594 4597 'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase', 4595 - 'PhabricatorProjectHistoryController' => 'PhabricatorProjectController', 4596 4598 'PhabricatorProjectListController' => 4597 4599 array( 4598 4600 0 => 'PhabricatorProjectController', ··· 4604 4606 'PhabricatorProjectPHIDTypeColumn' => 'PhabricatorPHIDType', 4605 4607 'PhabricatorProjectPHIDTypeProject' => 'PhabricatorPHIDType', 4606 4608 'PhabricatorProjectProfileController' => 'PhabricatorProjectController', 4607 - 'PhabricatorProjectProfileEditController' => 'PhabricatorProjectController', 4608 - 'PhabricatorProjectProfilePictureController' => 'PhabricatorProjectController', 4609 4609 'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 4610 4610 'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine', 4611 4611 'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
+5 -3
src/applications/project/application/PhabricatorApplicationProject.php
··· 37 37 '/project/' => array( 38 38 '(?:query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorProjectListController', 39 39 'filter/(?P<filter>[^/]+)/' => 'PhabricatorProjectListController', 40 - 'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectProfileEditController', 40 + 'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectEditMainController', 41 + 'details/(?P<id>[1-9]\d*)/' 42 + => 'PhabricatorProjectEditDetailsController', 41 43 'archive/(?P<id>[1-9]\d*)/' => 42 44 'PhabricatorProjectArchiveController', 43 45 'members/(?P<id>[1-9]\d*)/' 44 46 => 'PhabricatorProjectMembersEditController', 45 - 'view/(?P<id>[1-9]\d*)/(?:(?P<page>\w+)/)?' 47 + 'view/(?P<id>[1-9]\d*)/' 46 48 => 'PhabricatorProjectProfileController', 47 49 'picture/(?P<id>[1-9]\d*)/' => 48 - 'PhabricatorProjectProfilePictureController', 50 + 'PhabricatorProjectEditPictureController', 49 51 'create/' => 'PhabricatorProjectCreateController', 50 52 'board/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectBoardController', 51 53 'move/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectMoveController',
+3 -3
src/applications/project/controller/PhabricatorProjectArchiveController.php
··· 26 26 return new Aphront404Response(); 27 27 } 28 28 29 - $view_uri = $this->getApplicationURI('view/'.$project->getID().'/'); 29 + $edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/'); 30 30 31 31 if ($request->isFormPost()) { 32 32 if ($project->isArchived()) { ··· 48 48 ->setContinueOnMissingFields(true) 49 49 ->applyTransactions($project, $xactions); 50 50 51 - return id(new AphrontRedirectResponse())->setURI($view_uri); 51 + return id(new AphrontRedirectResponse())->setURI($edit_uri); 52 52 } 53 53 54 54 if ($project->isArchived()) { ··· 65 65 ->setUser($viewer) 66 66 ->setTitle($title) 67 67 ->appendChild($body) 68 - ->addCancelButton($view_uri) 68 + ->addCancelButton($edit_uri) 69 69 ->addSubmitButton($button); 70 70 71 71 return id(new AphrontDialogResponse())->setDialog($dialog);
+155
src/applications/project/controller/PhabricatorProjectEditMainController.php
··· 1 + <?php 2 + 3 + final class PhabricatorProjectEditMainController 4 + extends PhabricatorProjectController { 5 + 6 + private $id; 7 + 8 + public function willProcessRequest(array $data) { 9 + $this->id = idx($data, 'id'); 10 + } 11 + 12 + public function processRequest() { 13 + $request = $this->getRequest(); 14 + $viewer = $request->getUser(); 15 + 16 + $project = id(new PhabricatorProjectQuery()) 17 + ->setViewer($viewer) 18 + ->withIDs(array($this->id)) 19 + ->needImages(true) 20 + ->executeOne(); 21 + if (!$project) { 22 + return new Aphront404Response(); 23 + } 24 + 25 + $header = id(new PHUIHeaderView()) 26 + ->setHeader(pht('Edit %s', $project->getName())) 27 + ->setUser($viewer) 28 + ->setPolicyObject($project) 29 + ->setImage($project->getProfileImageURI()); 30 + 31 + if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ACTIVE) { 32 + $header->setStatus('oh-ok', '', pht('Active')); 33 + } else { 34 + $header->setStatus('policy-noone', '', pht('Archived')); 35 + } 36 + 37 + $actions = $this->buildActionListView($project); 38 + $properties = $this->buildPropertyListView($project, $actions); 39 + 40 + $crumbs = $this->buildApplicationCrumbs(); 41 + $crumbs->addTextCrumb( 42 + $project->getName(), 43 + $this->getApplicationURI('view/'.$project->getID().'/')); 44 + $crumbs->addTextCrumb(pht('Edit')); 45 + 46 + $object_box = id(new PHUIObjectBoxView()) 47 + ->setHeader($header) 48 + ->addPropertyList($properties); 49 + 50 + $xactions = id(new PhabricatorProjectTransactionQuery()) 51 + ->setViewer($viewer) 52 + ->withObjectPHIDs(array($project->getPHID())) 53 + ->execute(); 54 + 55 + $timeline = id(new PhabricatorApplicationTransactionView()) 56 + ->setUser($viewer) 57 + ->setObjectPHID($project->getPHID()) 58 + ->setTransactions($xactions); 59 + 60 + return $this->buildApplicationPage( 61 + array( 62 + $crumbs, 63 + $object_box, 64 + $timeline, 65 + ), 66 + array( 67 + 'title' => $project->getName(), 68 + 'device' => true, 69 + )); 70 + } 71 + 72 + private function buildActionListView(PhabricatorProject $project) { 73 + $request = $this->getRequest(); 74 + $viewer = $request->getUser(); 75 + 76 + $id = $project->getID(); 77 + 78 + $view = id(new PhabricatorActionListView()) 79 + ->setUser($viewer) 80 + ->setObjectURI($request->getRequestURI()); 81 + 82 + $can_edit = PhabricatorPolicyFilter::hasCapability( 83 + $viewer, 84 + $project, 85 + PhabricatorPolicyCapability::CAN_EDIT); 86 + 87 + $view->addAction( 88 + id(new PhabricatorActionView()) 89 + ->setName(pht('Edit Details')) 90 + ->setIcon('edit') 91 + ->setHref($this->getApplicationURI("details/{$id}/")) 92 + ->setDisabled(!$can_edit) 93 + ->setWorkflow(!$can_edit)); 94 + 95 + $view->addAction( 96 + id(new PhabricatorActionView()) 97 + ->setName(pht('Edit Picture')) 98 + ->setIcon('image') 99 + ->setHref($this->getApplicationURI("picture/{$id}/")) 100 + ->setDisabled(!$can_edit) 101 + ->setWorkflow(!$can_edit)); 102 + 103 + if ($project->isArchived()) { 104 + $view->addAction( 105 + id(new PhabricatorActionView()) 106 + ->setName(pht('Unarchive Project')) 107 + ->setIcon('enable') 108 + ->setHref($this->getApplicationURI("archive/{$id}/")) 109 + ->setDisabled(!$can_edit) 110 + ->setWorkflow(true)); 111 + } else { 112 + $view->addAction( 113 + id(new PhabricatorActionView()) 114 + ->setName(pht('Archive Project')) 115 + ->setIcon('disable') 116 + ->setHref($this->getApplicationURI("archive/{$id}/")) 117 + ->setDisabled(!$can_edit) 118 + ->setWorkflow(true)); 119 + } 120 + 121 + return $view; 122 + } 123 + 124 + private function buildPropertyListView( 125 + PhabricatorProject $project, 126 + PhabricatorActionListView $actions) { 127 + $request = $this->getRequest(); 128 + $viewer = $request->getUser(); 129 + 130 + $view = id(new PHUIPropertyListView()) 131 + ->setUser($viewer) 132 + ->setObject($project) 133 + ->setActionList($actions); 134 + 135 + $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( 136 + $viewer, 137 + $project); 138 + 139 + $view->addProperty( 140 + pht('Visible To'), 141 + $descriptions[PhabricatorPolicyCapability::CAN_VIEW]); 142 + 143 + $view->addProperty( 144 + pht('Editable By'), 145 + $descriptions[PhabricatorPolicyCapability::CAN_EDIT]); 146 + 147 + $view->addProperty( 148 + pht('Joinable By'), 149 + $descriptions[PhabricatorPolicyCapability::CAN_JOIN]); 150 + 151 + return $view; 152 + } 153 + 154 + 155 + }
-57
src/applications/project/controller/PhabricatorProjectHistoryController.php
··· 1 - <?php 2 - 3 - final class PhabricatorProjectHistoryController 4 - extends PhabricatorProjectController { 5 - 6 - private $id; 7 - 8 - public function shouldAllowPublic() { 9 - return true; 10 - } 11 - 12 - public function willProcessRequest(array $data) { 13 - $this->id = $data['id']; 14 - } 15 - 16 - public function processRequest() { 17 - $request = $this->getRequest(); 18 - $viewer = $request->getUser(); 19 - 20 - $id = $this->id; 21 - 22 - $project = id(new PhabricatorProjectQuery()) 23 - ->setViewer($viewer) 24 - ->withIDs(array($id)) 25 - ->executeOne(); 26 - if (!$project) { 27 - return new Aphront404Response(); 28 - } 29 - 30 - $xactions = id(new PhabricatorProjectTransactionQuery()) 31 - ->setViewer($viewer) 32 - ->withObjectPHIDs(array($project->getPHID())) 33 - ->execute(); 34 - 35 - $timeline = id(new PhabricatorApplicationTransactionView()) 36 - ->setUser($viewer) 37 - ->setObjectPHID($project->getPHID()) 38 - ->setTransactions($xactions); 39 - 40 - $crumbs = $this->buildApplicationCrumbs() 41 - ->addTextCrumb( 42 - $project->getName(), 43 - $this->getApplicationURI("view/{$id}/")) 44 - ->addTextCrumb(pht('History')); 45 - 46 - return $this->buildApplicationPage( 47 - array( 48 - $crumbs, 49 - $timeline, 50 - ), 51 - array( 52 - 'title' => $project->getName(), 53 - 'device' => true, 54 - )); 55 - } 56 - 57 - }
+2 -43
src/applications/project/controller/PhabricatorProjectProfileController.php
··· 4 4 extends PhabricatorProjectController { 5 5 6 6 private $id; 7 - private $page; 8 7 9 8 public function shouldAllowPublic() { 10 9 return true; ··· 12 11 13 12 public function willProcessRequest(array $data) { 14 13 $this->id = idx($data, 'id'); 15 - $this->page = idx($data, 'page'); 16 14 } 17 15 18 16 public function processRequest() { ··· 200 198 id(new PhabricatorActionView()) 201 199 ->setName(pht('Edit Project')) 202 200 ->setIcon('edit') 203 - ->setHref($this->getApplicationURI("edit/{$id}/")) 204 - ->setDisabled(!$can_edit) 205 - ->setWorkflow(!$can_edit)); 206 - 207 - if ($project->isArchived()) { 208 - $view->addAction( 209 - id(new PhabricatorActionView()) 210 - ->setName(pht('Unarchive Project')) 211 - ->setIcon('enable') 212 - ->setHref($this->getApplicationURI("archive/{$id}/")) 213 - ->setDisabled(!$can_edit) 214 - ->setWorkflow(true)); 215 - } else { 216 - $view->addAction( 217 - id(new PhabricatorActionView()) 218 - ->setName(pht('Archive Project')) 219 - ->setIcon('disable') 220 - ->setHref($this->getApplicationURI("archive/{$id}/")) 221 - ->setDisabled(!$can_edit) 222 - ->setWorkflow(true)); 223 - } 201 + ->setHref($this->getApplicationURI("edit/{$id}/"))); 224 202 225 203 $view->addAction( 226 204 id(new PhabricatorActionView()) 227 205 ->setName(pht('Edit Members')) 228 - ->setIcon('edit') 206 + ->setIcon('user') 229 207 ->setHref($this->getApplicationURI("members/{$id}/")) 230 208 ->setDisabled(!$can_edit) 231 209 ->setWorkflow(!$can_edit)); 232 - 233 - $view->addAction( 234 - id(new PhabricatorActionView()) 235 - ->setName(pht('Edit Picture')) 236 - ->setIcon('image') 237 - ->setHref($this->getApplicationURI("picture/{$id}/")) 238 - ->setDisabled(!$can_edit) 239 - ->setWorkflow(!$can_edit)); 240 - 241 210 242 211 $action = null; 243 212 if (!$project->isUserMember($viewer->getPHID())) { ··· 262 231 } 263 232 $view->addAction($action); 264 233 265 - $view->addAction( 266 - id(new PhabricatorActionView()) 267 - ->setName(pht('View History')) 268 - ->setHref($this->getApplicationURI("history/{$id}/")) 269 - ->setIcon('transcript')); 270 - 271 234 return $view; 272 235 } 273 236 ··· 283 246 ->setUser($viewer) 284 247 ->setObject($project) 285 248 ->setActionList($actions); 286 - 287 - $view->addProperty( 288 - pht('Created'), 289 - phabricator_datetime($project->getDateCreated(), $viewer)); 290 249 291 250 $view->addProperty( 292 251 pht('Members'),
+6 -5
src/applications/project/controller/PhabricatorProjectProfileEditController.php src/applications/project/controller/PhabricatorProjectEditDetailsController.php
··· 1 1 <?php 2 2 3 - final class PhabricatorProjectProfileEditController 3 + final class PhabricatorProjectEditDetailsController 4 4 extends PhabricatorProjectController { 5 5 6 6 private $id; ··· 34 34 ->readFieldsFromStorage($project); 35 35 36 36 $view_uri = $this->getApplicationURI('view/'.$project->getID().'/'); 37 + $edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/'); 37 38 38 39 $e_name = true; 39 40 $e_edit = null; ··· 81 82 try { 82 83 $editor->applyTransactions($project, $xactions); 83 84 84 - return id(new AphrontRedirectResponse())->setURI($view_uri); 85 + return id(new AphrontRedirectResponse())->setURI($edit_uri); 85 86 } catch (PhabricatorApplicationTransactionValidationException $ex) { 86 87 $validation_exception = $ex; 87 88 ··· 119 120 id(new AphrontFormPolicyControl()) 120 121 ->setUser($viewer) 121 122 ->setName('can_view') 122 - ->setCaption(pht('Members can always view a project.')) 123 123 ->setPolicyObject($project) 124 124 ->setPolicies($policies) 125 125 ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)) ··· 142 142 ->setCapability(PhabricatorPolicyCapability::CAN_JOIN)) 143 143 ->appendChild( 144 144 id(new AphrontFormSubmitControl()) 145 - ->addCancelButton($view_uri) 145 + ->addCancelButton($edit_uri) 146 146 ->setValue(pht('Save'))); 147 147 148 148 $form_box = id(new PHUIObjectBoxView()) ··· 152 152 153 153 $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()) 154 154 ->addTextCrumb($project->getName(), $view_uri) 155 - ->addTextCrumb(pht('Edit Project'), $this->getApplicationURI()); 155 + ->addTextCrumb(pht('Edit'), $edit_uri) 156 + ->addTextCrumb(pht('Details')); 156 157 157 158 return $this->buildApplicationPage( 158 159 array(
+8 -6
src/applications/project/controller/PhabricatorProjectProfilePictureController.php src/applications/project/controller/PhabricatorProjectEditPictureController.php
··· 1 1 <?php 2 2 3 - final class PhabricatorProjectProfilePictureController 3 + final class PhabricatorProjectEditPictureController 4 4 extends PhabricatorProjectController { 5 5 6 6 private $id; ··· 26 26 return new Aphront404Response(); 27 27 } 28 28 29 - $project_uri = $this->getApplicationURI('view/'.$project->getID().'/'); 29 + $edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/'); 30 + $view_uri = $this->getApplicationURI('view/'.$project->getID().'/'); 30 31 31 32 $supported_formats = PhabricatorFile::getTransformableImageFormats(); 32 33 $e_file = true; ··· 93 94 94 95 $editor->applyTransactions($project, $xactions); 95 96 96 - return id(new AphrontRedirectResponse())->setURI($project_uri); 97 + return id(new AphrontRedirectResponse())->setURI($edit_uri); 97 98 } 98 99 } 99 100 100 101 $title = pht('Edit Project Picture'); 101 102 $crumbs = $this->buildApplicationCrumbs(); 102 - $crumbs->addTextCrumb($project->getName(), $project_uri); 103 - $crumbs->addTextCrumb($title); 103 + $crumbs->addTextCrumb($project->getName(), $view_uri); 104 + $crumbs->addTextCrumb(pht('Edit'), $edit_uri); 105 + $crumbs->addTextCrumb(pht('Picture')); 104 106 105 107 $form = id(new PHUIFormLayoutView()) 106 108 ->setUser($viewer); ··· 244 246 pht('Supported formats: %s', implode(', ', $supported_formats)))) 245 247 ->appendChild( 246 248 id(new AphrontFormSubmitControl()) 247 - ->addCancelButton($project_uri) 249 + ->addCancelButton($edit_uri) 248 250 ->setValue(pht('Upload Picture'))); 249 251 250 252 $form_box = id(new PHUIObjectBoxView())