Skip to content

Commit 6fe882e

Browse files
author
epriestley
committed
Convert projects to EditEngine
Summary: Ref T10010. This is pretty straightforward with a couple of very minor new behaviors, like the icon selector edit field. Test Plan: - Created projects. - Edited projects. - Saw "Create Project" in quick create menu. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10010 Differential Revision: https://secure.phabricator.com/D14896
1 parent e8ddfad commit 6fe882e

14 files changed

+288
-317
lines changed

src/__phutil_library_map__.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,6 +2381,7 @@
23812381
'PhabricatorIRCProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php',
23822382
'PhabricatorIconRemarkupRule' => 'applications/macro/markup/PhabricatorIconRemarkupRule.php',
23832383
'PhabricatorIconSet' => 'applications/files/iconset/PhabricatorIconSet.php',
2384+
'PhabricatorIconSetEditField' => 'applications/transactions/editfield/PhabricatorIconSetEditField.php',
23842385
'PhabricatorIconSetIcon' => 'applications/files/iconset/PhabricatorIconSetIcon.php',
23852386
'PhabricatorImageMacroRemarkupRule' => 'applications/macro/markup/PhabricatorImageMacroRemarkupRule.php',
23862387
'PhabricatorImageTransformer' => 'applications/files/PhabricatorImageTransformer.php',
@@ -2845,7 +2846,8 @@
28452846
'PhabricatorProjectDAO' => 'applications/project/storage/PhabricatorProjectDAO.php',
28462847
'PhabricatorProjectDatasource' => 'applications/project/typeahead/PhabricatorProjectDatasource.php',
28472848
'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php',
2848-
'PhabricatorProjectEditDetailsController' => 'applications/project/controller/PhabricatorProjectEditDetailsController.php',
2849+
'PhabricatorProjectEditController' => 'applications/project/controller/PhabricatorProjectEditController.php',
2850+
'PhabricatorProjectEditEngine' => 'applications/project/engine/PhabricatorProjectEditEngine.php',
28492851
'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php',
28502852
'PhabricatorProjectFeedController' => 'applications/project/controller/PhabricatorProjectFeedController.php',
28512853
'PhabricatorProjectFulltextEngine' => 'applications/project/search/PhabricatorProjectFulltextEngine.php',
@@ -3187,6 +3189,7 @@
31873189
'PhabricatorStorageSchemaSpec' => 'infrastructure/storage/schema/PhabricatorStorageSchemaSpec.php',
31883190
'PhabricatorStorageSetupCheck' => 'applications/config/check/PhabricatorStorageSetupCheck.php',
31893191
'PhabricatorStreamingProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorStreamingProtocolAdapter.php',
3192+
'PhabricatorStringListEditField' => 'applications/transactions/editfield/PhabricatorStringListEditField.php',
31903193
'PhabricatorSubscribableInterface' => 'applications/subscriptions/interface/PhabricatorSubscribableInterface.php',
31913194
'PhabricatorSubscribedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorSubscribedToObjectEdgeType.php',
31923195
'PhabricatorSubscribersEditField' => 'applications/transactions/editfield/PhabricatorSubscribersEditField.php',
@@ -3746,6 +3749,7 @@
37463749
'ProjectDefaultEditCapability' => 'applications/project/capability/ProjectDefaultEditCapability.php',
37473750
'ProjectDefaultJoinCapability' => 'applications/project/capability/ProjectDefaultJoinCapability.php',
37483751
'ProjectDefaultViewCapability' => 'applications/project/capability/ProjectDefaultViewCapability.php',
3752+
'ProjectEditConduitAPIMethod' => 'applications/project/conduit/ProjectEditConduitAPIMethod.php',
37493753
'ProjectQueryConduitAPIMethod' => 'applications/project/conduit/ProjectQueryConduitAPIMethod.php',
37503754
'ProjectRemarkupRule' => 'applications/project/remarkup/ProjectRemarkupRule.php',
37513755
'ProjectRemarkupRuleTestCase' => 'applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php',
@@ -6642,6 +6646,7 @@
66426646
'PhabricatorIRCProtocolAdapter' => 'PhabricatorProtocolAdapter',
66436647
'PhabricatorIconRemarkupRule' => 'PhutilRemarkupRule',
66446648
'PhabricatorIconSet' => 'Phobject',
6649+
'PhabricatorIconSetEditField' => 'PhabricatorEditField',
66456650
'PhabricatorIconSetIcon' => 'Phobject',
66466651
'PhabricatorImageMacroRemarkupRule' => 'PhutilRemarkupRule',
66476652
'PhabricatorImageTransformer' => 'Phobject',
@@ -7192,7 +7197,8 @@
71927197
'PhabricatorProjectDAO' => 'PhabricatorLiskDAO',
71937198
'PhabricatorProjectDatasource' => 'PhabricatorTypeaheadDatasource',
71947199
'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField',
7195-
'PhabricatorProjectEditDetailsController' => 'PhabricatorProjectController',
7200+
'PhabricatorProjectEditController' => 'PhabricatorProjectController',
7201+
'PhabricatorProjectEditEngine' => 'PhabricatorEditEngine',
71967202
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
71977203
'PhabricatorProjectFeedController' => 'PhabricatorProjectController',
71987204
'PhabricatorProjectFulltextEngine' => 'PhabricatorFulltextEngine',
@@ -7594,6 +7600,7 @@
75947600
'PhabricatorStorageSchemaSpec' => 'PhabricatorConfigSchemaSpec',
75957601
'PhabricatorStorageSetupCheck' => 'PhabricatorSetupCheck',
75967602
'PhabricatorStreamingProtocolAdapter' => 'PhabricatorProtocolAdapter',
7603+
'PhabricatorStringListEditField' => 'PhabricatorEditField',
75977604
'PhabricatorSubscribedToObjectEdgeType' => 'PhabricatorEdgeType',
75987605
'PhabricatorSubscribersEditField' => 'PhabricatorTokenizerEditField',
75997606
'PhabricatorSubscribersQuery' => 'PhabricatorQuery',
@@ -8300,6 +8307,7 @@
83008307
'ProjectDefaultEditCapability' => 'PhabricatorPolicyCapability',
83018308
'ProjectDefaultJoinCapability' => 'PhabricatorPolicyCapability',
83028309
'ProjectDefaultViewCapability' => 'PhabricatorPolicyCapability',
8310+
'ProjectEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
83038311
'ProjectQueryConduitAPIMethod' => 'ProjectConduitAPIMethod',
83048312
'ProjectRemarkupRule' => 'PhabricatorObjectRemarkupRule',
83058313
'ProjectRemarkupRuleTestCase' => 'PhabricatorTestCase',

src/applications/project/application/PhabricatorProjectApplication.php

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public function getRoutes() {
4343
'/project/' => array(
4444
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorProjectListController',
4545
'filter/(?P<filter>[^/]+)/' => 'PhabricatorProjectListController',
46-
'details/(?P<id>[1-9]\d*)/'
47-
=> 'PhabricatorProjectEditDetailsController',
4846
'archive/(?P<id>[1-9]\d*)/'
4947
=> 'PhabricatorProjectArchiveController',
5048
'lock/(?P<id>[1-9]\d*)/'
@@ -61,7 +59,8 @@ public function getRoutes() {
6159
=> 'PhabricatorProjectViewController',
6260
'picture/(?P<id>[1-9]\d*)/'
6361
=> 'PhabricatorProjectEditPictureController',
64-
'create/' => 'PhabricatorProjectEditDetailsController',
62+
$this->getEditRoutePattern('edit/')
63+
=> 'PhabricatorProjectEditController',
6564
'subprojects/(?P<id>[1-9]\d*)/'
6665
=> 'PhabricatorProjectSubprojectsController',
6766
'milestones/(?P<id>[1-9]\d*)/'
@@ -97,21 +96,9 @@ public function getRoutes() {
9796
}
9897

9998
public function getQuickCreateItems(PhabricatorUser $viewer) {
100-
$can_create = PhabricatorPolicyFilter::hasCapability(
101-
$viewer,
102-
$this,
103-
ProjectCreateProjectsCapability::CAPABILITY);
104-
105-
$items = array();
106-
if ($can_create) {
107-
$item = id(new PHUIListItemView())
108-
->setName(pht('Project'))
109-
->setIcon('fa-briefcase')
110-
->setHref($this->getBaseURI().'create/');
111-
$items[] = $item;
112-
}
113-
114-
return $items;
99+
return id(new PhabricatorProjectEditEngine())
100+
->setViewer($viewer)
101+
->loadQuickCreateItems();
115102
}
116103

117104
protected function getCustomCapabilities() {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
final class ProjectEditConduitAPIMethod
4+
extends PhabricatorEditEngineAPIMethod {
5+
6+
public function getAPIMethodName() {
7+
return 'project.edit';
8+
}
9+
10+
public function newEditEngine() {
11+
return new PhabricatorProjectEditEngine();
12+
}
13+
14+
public function getMethodSummary() {
15+
return pht(
16+
'Apply transactions to create a new project or edit an existing one.');
17+
}
18+
19+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
final class PhabricatorProjectEditController
4+
extends PhabricatorProjectController {
5+
6+
public function handleRequest(AphrontRequest $request) {
7+
return id(new PhabricatorProjectEditEngine())
8+
->setController($this)
9+
->buildResponse();
10+
}
11+
12+
}

0 commit comments

Comments
 (0)