From f3d9a0b93000dd545de32babab84720cd8e39ec4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 11 Dec 2016 07:15:32 -0800 Subject: [PATCH 01/78] Fix two cache issues (global settings; initial setup) Summary: - Fixes T11995. This got moved but I missed renaming this callsite. - Fixes T11993. If you have valid credentials, but haven't run `storage upgrade` yet, we can hit this exception during setup. Just ignore it instead. Test Plan: - Saved global settings, no more fatal. - Changed `storage-namespace` to junk, loaded web UI with valid database credentials. {F2106358} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11993, T11995 Differential Revision: https://secure.phabricator.com/D17024 --- src/applications/config/check/PhabricatorSetupCheck.php | 8 ++------ .../settings/editor/PhabricatorUserPreferencesEditor.php | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/applications/config/check/PhabricatorSetupCheck.php b/src/applications/config/check/PhabricatorSetupCheck.php index 0d9101efe3..e0574b7636 100644 --- a/src/applications/config/check/PhabricatorSetupCheck.php +++ b/src/applications/config/check/PhabricatorSetupCheck.php @@ -82,12 +82,12 @@ abstract class PhabricatorSetupCheck extends Phobject { AphrontWriteGuard::allowDangerousUnguardedWrites(true); } - $caught = null; try { $db_cache = new PhabricatorKeyValueDatabaseCache(); $db_cache->deleteKey('phabricator.setup.issue-keys'); } catch (Exception $ex) { - $caught = $ex; + // If we hit an exception here, just ignore it. In particular, this can + // happen on initial startup before the databases are initialized. } if ($use_scope) { @@ -95,10 +95,6 @@ abstract class PhabricatorSetupCheck extends Phobject { } else { AphrontWriteGuard::allowDangerousUnguardedWrites(false); } - - if ($caught) { - throw $caught; - } } final public static function setOpenSetupIssueKeys( diff --git a/src/applications/settings/editor/PhabricatorUserPreferencesEditor.php b/src/applications/settings/editor/PhabricatorUserPreferencesEditor.php index c2ec0a7094..a927cc7475 100644 --- a/src/applications/settings/editor/PhabricatorUserPreferencesEditor.php +++ b/src/applications/settings/editor/PhabricatorUserPreferencesEditor.php @@ -159,7 +159,7 @@ final class PhabricatorUserPreferencesEditor $user_phid); } else { $cache = PhabricatorCaches::getMutableStructureCache(); - $cache->deleteKey(PhabricatorUserPreferences::getGlobalCacheKey()); + $cache->deleteKey(PhabricatorUser::getGlobalSettingsCacheKey()); PhabricatorUserCache::clearCacheForAllUsers( PhabricatorUserPreferencesCacheType::KEY_PREFERENCES); From fddd46740064220fc6458292463a27a2d5a9991c Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sun, 11 Dec 2016 17:21:16 +0000 Subject: [PATCH 02/78] Fake an outline ring on buttons Summary: Fixes T11990. Chrome/Ubuntu doesn't respect `outline: auto`, so this is the only workaround I could fine. Somewhat nicer than stock Chrome. Test Plan: tab tab tab tab, ubuntu, chrome, windows, safari. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T11990 Differential Revision: https://secure.phabricator.com/D17023 --- resources/celerity/map.php | 6 +++--- webroot/rsrc/css/phui/phui-button.css | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 7771a79107..432d76abd3 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '0b64e988', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => '35e6c1ed', + 'core.pkg.css' => '1ef46ae8', 'core.pkg.js' => 'e4260032', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'a4ba74b5', @@ -128,7 +128,7 @@ return array( 'rsrc/css/phui/phui-basic-nav-view.css' => '7093573b', 'rsrc/css/phui/phui-big-info-view.css' => 'bd903741', 'rsrc/css/phui/phui-box.css' => '5c8387cf', - 'rsrc/css/phui/phui-button.css' => '4a5fbe3d', + 'rsrc/css/phui/phui-button.css' => '43f4912e', 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 'rsrc/css/phui/phui-cms.css' => 'be43c8a8', 'rsrc/css/phui/phui-comment-form.css' => 'c953b75e', @@ -837,7 +837,7 @@ return array( 'phui-basic-nav-view-css' => '7093573b', 'phui-big-info-view-css' => 'bd903741', 'phui-box-css' => '5c8387cf', - 'phui-button-css' => '4a5fbe3d', + 'phui-button-css' => '43f4912e', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', 'phui-calendar-list-css' => 'fcc9fb41', diff --git a/webroot/rsrc/css/phui/phui-button.css b/webroot/rsrc/css/phui/phui-button.css index 51807fa48e..15142d3b1a 100644 --- a/webroot/rsrc/css/phui/phui-button.css +++ b/webroot/rsrc/css/phui/phui-button.css @@ -17,9 +17,16 @@ button.phabricator-action-view-item { -webkit-font-smoothing: auto; } -button::-moz-focus-inner { - padding: 0; +button::-moz-focus-inner, +input::-moz-focus-inner { border: 0; + padding: 0; +} + +button:focus, +a.button:focus { + outline: 0; + box-shadow: 0 0 2pt 2pt rgba(82, 168, 236, 0.7); } button, From 923d3d3060628d1e61e34d7141a6c00433cd964d Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 11 Dec 2016 09:00:44 -0800 Subject: [PATCH 03/78] Rename "PanelEngine" to "MenuEngine" Summary: Ref T11957. Test Plan: Grepped for "PanelEngine", renamed everything except "PanelEditEngine". Grepped for these changed symbols: ``` ispanelengineconfigurable getprofilepanelengine setprofilepanelengine setpanelengine getpanelengine PhabricatorProfilePanelEditEngine ``` Reviewers: chad Reviewed By: chad Maniphest Tasks: T11957 Differential Revision: https://secure.phabricator.com/D17025 --- src/__phutil_library_map__.php | 12 +++++------ .../PhabricatorPeopleProfileController.php | 2 +- ...PhabricatorPeopleProfileEditController.php | 2 +- ...abricatorPeopleProfileManageController.php | 2 +- ...bricatorPeopleProfilePictureController.php | 2 +- ...PhabricatorPeopleProfileViewController.php | 2 +- ...=> PhabricatorPeopleProfileMenuEngine.php} | 6 +++--- .../PhabricatorProjectBoardViewController.php | 2 +- .../PhabricatorProjectController.php | 21 ++++++++++--------- .../PhabricatorProjectPanelController.php | 4 ++-- .../PhabricatorProjectViewController.php | 2 +- ...> PhabricatorProjectProfileMenuEngine.php} | 6 +++--- .../PhabricatorProfilePanelEditEngine.php | 14 ++++++------- ...e.php => PhabricatorProfileMenuEngine.php} | 12 +++++------ 14 files changed, 45 insertions(+), 44 deletions(-) rename src/applications/people/engine/{PhabricatorPeopleProfilePanelEngine.php => PhabricatorPeopleProfileMenuEngine.php} (94%) rename src/applications/project/engine/{PhabricatorProjectProfilePanelEngine.php => PhabricatorProjectProfileMenuEngine.php} (90%) rename src/applications/search/engine/{PhabricatorProfilePanelEngine.php => PhabricatorProfileMenuEngine.php} (99%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 97799da03e..07c043d5e5 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3265,7 +3265,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleProfileController' => 'applications/people/controller/PhabricatorPeopleProfileController.php', 'PhabricatorPeopleProfileEditController' => 'applications/people/controller/PhabricatorPeopleProfileEditController.php', 'PhabricatorPeopleProfileManageController' => 'applications/people/controller/PhabricatorPeopleProfileManageController.php', - 'PhabricatorPeopleProfilePanelEngine' => 'applications/people/engine/PhabricatorPeopleProfilePanelEngine.php', + 'PhabricatorPeopleProfileMenuEngine' => 'applications/people/engine/PhabricatorPeopleProfileMenuEngine.php', 'PhabricatorPeopleProfilePictureController' => 'applications/people/controller/PhabricatorPeopleProfilePictureController.php', 'PhabricatorPeopleProfileViewController' => 'applications/people/controller/PhabricatorPeopleProfileViewController.php', 'PhabricatorPeopleQuery' => 'applications/people/query/PhabricatorPeopleQuery.php', @@ -3364,6 +3364,7 @@ phutil_register_library_map(array( 'PhabricatorPolicyType' => 'applications/policy/constants/PhabricatorPolicyType.php', 'PhabricatorPonderApplication' => 'applications/ponder/application/PhabricatorPonderApplication.php', 'PhabricatorProfileMenuCollapsedSetting' => 'applications/settings/setting/PhabricatorProfileMenuCollapsedSetting.php', + 'PhabricatorProfileMenuEngine' => 'applications/search/engine/PhabricatorProfileMenuEngine.php', 'PhabricatorProfilePanel' => 'applications/search/profilepanel/PhabricatorProfilePanel.php', 'PhabricatorProfilePanelConfiguration' => 'applications/search/storage/PhabricatorProfilePanelConfiguration.php', 'PhabricatorProfilePanelConfigurationQuery' => 'applications/search/query/PhabricatorProfilePanelConfigurationQuery.php', @@ -3371,7 +3372,6 @@ phutil_register_library_map(array( 'PhabricatorProfilePanelConfigurationTransactionQuery' => 'applications/search/query/PhabricatorProfilePanelConfigurationTransactionQuery.php', 'PhabricatorProfilePanelEditEngine' => 'applications/search/editor/PhabricatorProfilePanelEditEngine.php', 'PhabricatorProfilePanelEditor' => 'applications/search/editor/PhabricatorProfilePanelEditor.php', - 'PhabricatorProfilePanelEngine' => 'applications/search/engine/PhabricatorProfilePanelEngine.php', 'PhabricatorProfilePanelIconSet' => 'applications/search/profilepanel/PhabricatorProfilePanelIconSet.php', 'PhabricatorProfilePanelPHIDType' => 'applications/search/phidtype/PhabricatorProfilePanelPHIDType.php', 'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php', @@ -3452,7 +3452,7 @@ phutil_register_library_map(array( 'PhabricatorProjectPanelController' => 'applications/project/controller/PhabricatorProjectPanelController.php', 'PhabricatorProjectPointsProfilePanel' => 'applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php', 'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php', - 'PhabricatorProjectProfilePanelEngine' => 'applications/project/engine/PhabricatorProjectProfilePanelEngine.php', + 'PhabricatorProjectProfileMenuEngine' => 'applications/project/engine/PhabricatorProjectProfileMenuEngine.php', 'PhabricatorProjectProjectHasMemberEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasMemberEdgeType.php', 'PhabricatorProjectProjectHasObjectEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasObjectEdgeType.php', 'PhabricatorProjectProjectPHIDType' => 'applications/project/phid/PhabricatorProjectProjectPHIDType.php', @@ -8331,7 +8331,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleProfileController' => 'PhabricatorPeopleController', 'PhabricatorPeopleProfileEditController' => 'PhabricatorPeopleProfileController', 'PhabricatorPeopleProfileManageController' => 'PhabricatorPeopleProfileController', - 'PhabricatorPeopleProfilePanelEngine' => 'PhabricatorProfilePanelEngine', + 'PhabricatorPeopleProfileMenuEngine' => 'PhabricatorProfileMenuEngine', 'PhabricatorPeopleProfilePictureController' => 'PhabricatorPeopleProfileController', 'PhabricatorPeopleProfileViewController' => 'PhabricatorPeopleProfileController', 'PhabricatorPeopleQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -8450,6 +8450,7 @@ phutil_register_library_map(array( 'PhabricatorPolicyType' => 'PhabricatorPolicyConstants', 'PhabricatorPonderApplication' => 'PhabricatorApplication', 'PhabricatorProfileMenuCollapsedSetting' => 'PhabricatorInternalSetting', + 'PhabricatorProfileMenuEngine' => 'Phobject', 'PhabricatorProfilePanel' => 'Phobject', 'PhabricatorProfilePanelConfiguration' => array( 'PhabricatorSearchDAO', @@ -8462,7 +8463,6 @@ phutil_register_library_map(array( 'PhabricatorProfilePanelConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'PhabricatorProfilePanelEditEngine' => 'PhabricatorEditEngine', 'PhabricatorProfilePanelEditor' => 'PhabricatorApplicationTransactionEditor', - 'PhabricatorProfilePanelEngine' => 'Phobject', 'PhabricatorProfilePanelIconSet' => 'PhabricatorIconSet', 'PhabricatorProfilePanelPHIDType' => 'PhabricatorPHIDType', 'PhabricatorProject' => array( @@ -8565,7 +8565,7 @@ phutil_register_library_map(array( 'PhabricatorProjectPanelController' => 'PhabricatorProjectController', 'PhabricatorProjectPointsProfilePanel' => 'PhabricatorProfilePanel', 'PhabricatorProjectProfileController' => 'PhabricatorProjectController', - 'PhabricatorProjectProfilePanelEngine' => 'PhabricatorProfilePanelEngine', + 'PhabricatorProjectProfileMenuEngine' => 'PhabricatorProfileMenuEngine', 'PhabricatorProjectProjectHasMemberEdgeType' => 'PhabricatorEdgeType', 'PhabricatorProjectProjectHasObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorProjectProjectPHIDType' => 'PhabricatorPHIDType', diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php index 74705f9809..1e0a9cbe18 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php @@ -36,7 +36,7 @@ abstract class PhabricatorPeopleProfileController if ($user) { $viewer = $this->getViewer(); - $engine = id(new PhabricatorPeopleProfilePanelEngine()) + $engine = id(new PhabricatorPeopleProfileMenuEngine()) ->setViewer($viewer) ->setProfileObject($user); diff --git a/src/applications/people/controller/PhabricatorPeopleProfileEditController.php b/src/applications/people/controller/PhabricatorPeopleProfileEditController.php index 9f132a18d8..50fb0c29b5 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileEditController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileEditController.php @@ -85,7 +85,7 @@ final class PhabricatorPeopleProfileEditController $crumbs->setBorder(true); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorPeopleProfilePanelEngine::PANEL_MANAGE); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::PANEL_MANAGE); $header = id(new PHUIHeaderView()) ->setHeader(pht('Edit Profile: %s', $user->getFullName())) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileManageController.php b/src/applications/people/controller/PhabricatorPeopleProfileManageController.php index d298660bd3..6b087891be 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileManageController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileManageController.php @@ -43,7 +43,7 @@ final class PhabricatorPeopleProfileManageController $name = $user->getUsername(); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorPeopleProfilePanelEngine::PANEL_MANAGE); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::PANEL_MANAGE); $timeline = $this->buildTransactionTimeline( $user, diff --git a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php index 29b2290153..8a65a9b179 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php @@ -256,7 +256,7 @@ final class PhabricatorPeopleProfilePictureController $crumbs->setBorder(true); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorPeopleProfilePanelEngine::PANEL_MANAGE); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::PANEL_MANAGE); $header = id(new PHUIHeaderView()) ->setHeader(pht('Edit Profile Picture')) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php index 79134de017..a83a1f93ef 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -78,7 +78,7 @@ final class PhabricatorPeopleProfileViewController )); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorPeopleProfilePanelEngine::PANEL_PROFILE); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::PANEL_PROFILE); $crumbs = $this->buildApplicationCrumbs(); $crumbs->setBorder(true); diff --git a/src/applications/people/engine/PhabricatorPeopleProfilePanelEngine.php b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php similarity index 94% rename from src/applications/people/engine/PhabricatorPeopleProfilePanelEngine.php rename to src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php index db362d2049..847c20389c 100644 --- a/src/applications/people/engine/PhabricatorPeopleProfilePanelEngine.php +++ b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php @@ -1,12 +1,12 @@ getBool('default'); if ($set_default) { $this - ->getProfilePanelEngine() + ->getProfileMenuEngine() ->adjustDefault(PhabricatorProject::PANEL_WORKBOARD); } diff --git a/src/applications/project/controller/PhabricatorProjectController.php b/src/applications/project/controller/PhabricatorProjectController.php index 8da16f923b..45e2f193af 100644 --- a/src/applications/project/controller/PhabricatorProjectController.php +++ b/src/applications/project/controller/PhabricatorProjectController.php @@ -4,7 +4,7 @@ abstract class PhabricatorProjectController extends PhabricatorController { private $project; private $profileMenu; - private $profilePanelEngine; + private $profileMenuEngine; protected function setProject(PhabricatorProject $project) { $this->project = $project; @@ -99,7 +99,7 @@ abstract class PhabricatorProjectController extends PhabricatorController { protected function getProfileMenu() { if (!$this->profileMenu) { - $engine = $this->getProfilePanelEngine(); + $engine = $this->getProfileMenuEngine(); if ($engine) { $this->profileMenu = $engine->buildNavigation(); } @@ -127,24 +127,25 @@ abstract class PhabricatorProjectController extends PhabricatorController { return $crumbs; } - protected function getProfilePanelEngine() { - if (!$this->profilePanelEngine) { + protected function getProfileMenuEngine() { + if (!$this->profileMenuEngine) { $viewer = $this->getViewer(); $project = $this->getProject(); if ($project) { - $engine = id(new PhabricatorProjectProfilePanelEngine()) + $engine = id(new PhabricatorProjectProfileMenuEngine()) ->setViewer($viewer) ->setController($this) ->setProfileObject($project); - $this->profilePanelEngine = $engine; + $this->profileMenuEngine = $engine; } } - return $this->profilePanelEngine; + + return $this->profileMenuEngine; } - protected function setProfilePanelEngine( - PhabricatorProjectProfilePanelEngine $engine) { - $this->profilePanelEngine = $engine; + protected function setProfileMenuEngine( + PhabricatorProjectProfileMenuEngine $engine) { + $this->profileMenuEngine = $engine; return $this; } diff --git a/src/applications/project/controller/PhabricatorProjectPanelController.php b/src/applications/project/controller/PhabricatorProjectPanelController.php index d20b5b9828..940553368c 100644 --- a/src/applications/project/controller/PhabricatorProjectPanelController.php +++ b/src/applications/project/controller/PhabricatorProjectPanelController.php @@ -12,11 +12,11 @@ final class PhabricatorProjectPanelController $viewer = $this->getViewer(); $project = $this->getProject(); - $engine = id(new PhabricatorProjectProfilePanelEngine()) + $engine = id(new PhabricatorProjectProfileMenuEngine()) ->setProfileObject($project) ->setController($this); - $this->setProfilePanelEngine($engine); + $this->setProfileMenuEngine($engine); return $engine->buildResponse(); } diff --git a/src/applications/project/controller/PhabricatorProjectViewController.php b/src/applications/project/controller/PhabricatorProjectViewController.php index 412565c056..7a12d2c89c 100644 --- a/src/applications/project/controller/PhabricatorProjectViewController.php +++ b/src/applications/project/controller/PhabricatorProjectViewController.php @@ -17,7 +17,7 @@ final class PhabricatorProjectViewController } $project = $this->getProject(); - $engine = $this->getProfilePanelEngine(); + $engine = $this->getProfileMenuEngine(); $default = $engine->getDefaultPanel(); switch ($default->getBuiltinKey()) { diff --git a/src/applications/project/engine/PhabricatorProjectProfilePanelEngine.php b/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php similarity index 90% rename from src/applications/project/engine/PhabricatorProjectProfilePanelEngine.php rename to src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php index 3a34b6c80c..0c43a22a54 100644 --- a/src/applications/project/engine/PhabricatorProjectProfilePanelEngine.php +++ b/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php @@ -1,9 +1,9 @@ panelEngine = $engine; + public function setMenuEngine(PhabricatorProfileMenuEngine $engine) { + $this->menuEngine = $engine; return $this; } - public function getPanelEngine() { - return $this->panelEngine; + public function getMenuEngine() { + return $this->menuEngine; } public function setProfileObject($profile_object) { @@ -113,11 +113,11 @@ final class PhabricatorProfilePanelEditEngine } protected function getObjectCreateCancelURI($object) { - return $this->getPanelEngine()->getConfigureURI(); + return $this->getMenuEngine()->getConfigureURI(); } protected function getObjectViewURI($object) { - return $this->getPanelEngine()->getConfigureURI(); + return $this->getMenuEngine()->getConfigureURI(); } protected function buildCustomEditFields($object) { diff --git a/src/applications/search/engine/PhabricatorProfilePanelEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php similarity index 99% rename from src/applications/search/engine/PhabricatorProfilePanelEngine.php rename to src/applications/search/engine/PhabricatorProfileMenuEngine.php index d3c209ba68..4ed56557f9 100644 --- a/src/applications/search/engine/PhabricatorProfilePanelEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -1,6 +1,6 @@ getController(); @@ -63,7 +63,7 @@ abstract class PhabricatorProfilePanelEngine extends Phobject { // If the engine is not configurable, don't respond to any of the editing // or configuration routes. - if (!$this->isPanelEngineConfigurable()) { + if (!$this->isMenuEngineConfigurable()) { switch ($panel_action) { case 'view': break; @@ -709,7 +709,7 @@ abstract class PhabricatorProfilePanelEngine extends Phobject { $controller = $this->getController(); return id(new PhabricatorProfilePanelEditEngine()) - ->setPanelEngine($this) + ->setMenuEngine($this) ->setProfileObject($object) ->setNewPanelConfiguration($configuration) ->setController($controller) @@ -722,7 +722,7 @@ abstract class PhabricatorProfilePanelEngine extends Phobject { $controller = $this->getController(); return id(new PhabricatorProfilePanelEditEngine()) - ->setPanelEngine($this) + ->setMenuEngine($this) ->setProfileObject($object) ->setController($controller) ->buildResponse(); @@ -753,7 +753,7 @@ abstract class PhabricatorProfilePanelEngine extends Phobject { return id(new PhabricatorProfilePanelEditEngine()) ->setIsBuiltin(true) - ->setPanelEngine($this) + ->setMenuEngine($this) ->setProfileObject($object) ->setNewPanelConfiguration($configuration) ->setController($controller) From d6704705a752cccc8801e6a5e3d8dfb553f8a722 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 11 Dec 2016 09:06:43 -0800 Subject: [PATCH 04/78] Rename "ProfilePanelEditEngine" to "ProfileMenuEditEngine" Summary: Ref T11957. Test Plan: Edited profile menus, grepped for renamed symbol. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11957 Differential Revision: https://secure.phabricator.com/D17026 --- src/__phutil_library_map__.php | 4 ++-- ...lEditEngine.php => PhabricatorProfileMenuEditEngine.php} | 4 ++-- .../search/engine/PhabricatorProfileMenuEngine.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) rename src/applications/search/editor/{PhabricatorProfilePanelEditEngine.php => PhabricatorProfileMenuEditEngine.php} (97%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 07c043d5e5..804849a357 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3364,13 +3364,13 @@ phutil_register_library_map(array( 'PhabricatorPolicyType' => 'applications/policy/constants/PhabricatorPolicyType.php', 'PhabricatorPonderApplication' => 'applications/ponder/application/PhabricatorPonderApplication.php', 'PhabricatorProfileMenuCollapsedSetting' => 'applications/settings/setting/PhabricatorProfileMenuCollapsedSetting.php', + 'PhabricatorProfileMenuEditEngine' => 'applications/search/editor/PhabricatorProfileMenuEditEngine.php', 'PhabricatorProfileMenuEngine' => 'applications/search/engine/PhabricatorProfileMenuEngine.php', 'PhabricatorProfilePanel' => 'applications/search/profilepanel/PhabricatorProfilePanel.php', 'PhabricatorProfilePanelConfiguration' => 'applications/search/storage/PhabricatorProfilePanelConfiguration.php', 'PhabricatorProfilePanelConfigurationQuery' => 'applications/search/query/PhabricatorProfilePanelConfigurationQuery.php', 'PhabricatorProfilePanelConfigurationTransaction' => 'applications/search/storage/PhabricatorProfilePanelConfigurationTransaction.php', 'PhabricatorProfilePanelConfigurationTransactionQuery' => 'applications/search/query/PhabricatorProfilePanelConfigurationTransactionQuery.php', - 'PhabricatorProfilePanelEditEngine' => 'applications/search/editor/PhabricatorProfilePanelEditEngine.php', 'PhabricatorProfilePanelEditor' => 'applications/search/editor/PhabricatorProfilePanelEditor.php', 'PhabricatorProfilePanelIconSet' => 'applications/search/profilepanel/PhabricatorProfilePanelIconSet.php', 'PhabricatorProfilePanelPHIDType' => 'applications/search/phidtype/PhabricatorProfilePanelPHIDType.php', @@ -8450,6 +8450,7 @@ phutil_register_library_map(array( 'PhabricatorPolicyType' => 'PhabricatorPolicyConstants', 'PhabricatorPonderApplication' => 'PhabricatorApplication', 'PhabricatorProfileMenuCollapsedSetting' => 'PhabricatorInternalSetting', + 'PhabricatorProfileMenuEditEngine' => 'PhabricatorEditEngine', 'PhabricatorProfileMenuEngine' => 'Phobject', 'PhabricatorProfilePanel' => 'Phobject', 'PhabricatorProfilePanelConfiguration' => array( @@ -8461,7 +8462,6 @@ phutil_register_library_map(array( 'PhabricatorProfilePanelConfigurationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorProfilePanelConfigurationTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorProfilePanelConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery', - 'PhabricatorProfilePanelEditEngine' => 'PhabricatorEditEngine', 'PhabricatorProfilePanelEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorProfilePanelIconSet' => 'PhabricatorIconSet', 'PhabricatorProfilePanelPHIDType' => 'PhabricatorPHIDType', diff --git a/src/applications/search/editor/PhabricatorProfilePanelEditEngine.php b/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php similarity index 97% rename from src/applications/search/editor/PhabricatorProfilePanelEditEngine.php rename to src/applications/search/editor/PhabricatorProfileMenuEditEngine.php index 7d8e778461..1cbd4dc3fb 100644 --- a/src/applications/search/editor/PhabricatorProfilePanelEditEngine.php +++ b/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php @@ -1,9 +1,9 @@ getController(); - return id(new PhabricatorProfilePanelEditEngine()) + return id(new PhabricatorProfileMenuEditEngine()) ->setMenuEngine($this) ->setProfileObject($object) ->setNewPanelConfiguration($configuration) @@ -721,7 +721,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $object = $this->getProfileObject(); $controller = $this->getController(); - return id(new PhabricatorProfilePanelEditEngine()) + return id(new PhabricatorProfileMenuEditEngine()) ->setMenuEngine($this) ->setProfileObject($object) ->setController($controller) @@ -751,7 +751,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $object = $this->getProfileObject(); $controller = $this->getController(); - return id(new PhabricatorProfilePanelEditEngine()) + return id(new PhabricatorProfileMenuEditEngine()) ->setIsBuiltin(true) ->setMenuEngine($this) ->setProfileObject($object) From 8480776ccd995aa4b5c082973a96a316d9ad2a21 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 11 Dec 2016 09:38:06 -0800 Subject: [PATCH 05/78] Rename "ProfilePanelConfiguration" to "ProfileMenuItemConfiguration" Summary: Ref T11957. This renames the Configuration storage, transaction, query, and PHID type. No rename on the actual menu item types yet, that's next (and should be the end of this, I think). Test Plan: - Viewed projects. - Viewed profiles. - Edited a project menu. - Grepped for all renamed symbols, I think? Reviewers: chad Reviewed By: chad Maniphest Tasks: T11957 Differential Revision: https://secure.phabricator.com/D17027 --- .../autopatches/20161211.menu.01.itemkey.sql | 2 + .../20161211.menu.02.itemprops.sql | 3 + .../autopatches/20161211.menu.03.order.sql | 2 + src/__phutil_library_map__.php | 26 ++++----- .../PhabricatorPeopleProfileMenuEngine.php | 28 ++++----- .../PhabricatorPeopleDetailsProfilePanel.php | 10 ++-- .../PhabricatorPeopleManageProfilePanel.php | 12 ++-- .../PhabricatorProjectProfileMenuEngine.php | 12 ++-- .../PhabricatorProjectDetailsProfilePanel.php | 12 ++-- .../PhabricatorProjectManageProfilePanel.php | 14 ++--- .../PhabricatorProjectMembersProfilePanel.php | 10 ++-- .../PhabricatorProjectPointsProfilePanel.php | 6 +- ...bricatorProjectSubprojectsProfilePanel.php | 10 ++-- ...habricatorProjectWorkboardProfilePanel.php | 12 ++-- .../PhabricatorProfileMenuEditEngine.php | 6 +- ...r.php => PhabricatorProfileMenuEditor.php} | 45 +++++++------- .../engine/PhabricatorProfileMenuEngine.php | 58 ++++++++++--------- ...=> PhabricatorProfileMenuItemPHIDType.php} | 10 ++-- .../PhabricatorApplicationProfilePanel.php | 12 ++-- .../PhabricatorDividerProfilePanel.php | 6 +- .../PhabricatorLinkProfilePanel.php | 18 +++--- .../PhabricatorMotivatorProfilePanel.php | 10 ++-- .../profilepanel/PhabricatorProfilePanel.php | 12 ++-- ...atorProfileMenuItemConfigurationQuery.php} | 6 +- ...eMenuItemConfigurationTransactionQuery.php | 10 ++++ ...filePanelConfigurationTransactionQuery.php | 10 ---- ...abricatorProfileMenuItemConfiguration.php} | 43 ++++++++------ ...ofileMenuItemConfigurationTransaction.php} | 9 ++- .../storage/PhabricatorSearchSchemaSpec.php | 2 +- .../PhabricatorSettingsMainController.php | 4 +- 30 files changed, 221 insertions(+), 199 deletions(-) create mode 100644 resources/sql/autopatches/20161211.menu.01.itemkey.sql create mode 100644 resources/sql/autopatches/20161211.menu.02.itemprops.sql create mode 100644 resources/sql/autopatches/20161211.menu.03.order.sql rename src/applications/search/editor/{PhabricatorProfilePanelEditor.php => PhabricatorProfileMenuEditor.php} (52%) rename src/applications/search/phidtype/{PhabricatorProfilePanelPHIDType.php => PhabricatorProfileMenuItemPHIDType.php} (69%) rename src/applications/search/query/{PhabricatorProfilePanelConfigurationQuery.php => PhabricatorProfileMenuItemConfigurationQuery.php} (92%) create mode 100644 src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php delete mode 100644 src/applications/search/query/PhabricatorProfilePanelConfigurationTransactionQuery.php rename src/applications/search/storage/{PhabricatorProfilePanelConfiguration.php => PhabricatorProfileMenuItemConfiguration.php} (79%) rename src/applications/search/storage/{PhabricatorProfilePanelConfigurationTransaction.php => PhabricatorProfileMenuItemConfigurationTransaction.php} (59%) diff --git a/resources/sql/autopatches/20161211.menu.01.itemkey.sql b/resources/sql/autopatches/20161211.menu.01.itemkey.sql new file mode 100644 index 0000000000..71bfe257f0 --- /dev/null +++ b/resources/sql/autopatches/20161211.menu.01.itemkey.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration + CHANGE panelKey menuItemKey VARCHAR(64) NOT NULL COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20161211.menu.02.itemprops.sql b/resources/sql/autopatches/20161211.menu.02.itemprops.sql new file mode 100644 index 0000000000..cb9e296d42 --- /dev/null +++ b/resources/sql/autopatches/20161211.menu.02.itemprops.sql @@ -0,0 +1,3 @@ +ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration + CHANGE panelProperties menuItemProperties + LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20161211.menu.03.order.sql b/resources/sql/autopatches/20161211.menu.03.order.sql new file mode 100644 index 0000000000..01291ad4c6 --- /dev/null +++ b/resources/sql/autopatches/20161211.menu.03.order.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration + CHANGE panelOrder menuItemOrder INT UNSIGNED; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 804849a357..dca347a3e1 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3365,15 +3365,15 @@ phutil_register_library_map(array( 'PhabricatorPonderApplication' => 'applications/ponder/application/PhabricatorPonderApplication.php', 'PhabricatorProfileMenuCollapsedSetting' => 'applications/settings/setting/PhabricatorProfileMenuCollapsedSetting.php', 'PhabricatorProfileMenuEditEngine' => 'applications/search/editor/PhabricatorProfileMenuEditEngine.php', + 'PhabricatorProfileMenuEditor' => 'applications/search/editor/PhabricatorProfileMenuEditor.php', 'PhabricatorProfileMenuEngine' => 'applications/search/engine/PhabricatorProfileMenuEngine.php', + 'PhabricatorProfileMenuItemConfiguration' => 'applications/search/storage/PhabricatorProfileMenuItemConfiguration.php', + 'PhabricatorProfileMenuItemConfigurationQuery' => 'applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php', + 'PhabricatorProfileMenuItemConfigurationTransaction' => 'applications/search/storage/PhabricatorProfileMenuItemConfigurationTransaction.php', + 'PhabricatorProfileMenuItemConfigurationTransactionQuery' => 'applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php', + 'PhabricatorProfileMenuItemPHIDType' => 'applications/search/phidtype/PhabricatorProfileMenuItemPHIDType.php', 'PhabricatorProfilePanel' => 'applications/search/profilepanel/PhabricatorProfilePanel.php', - 'PhabricatorProfilePanelConfiguration' => 'applications/search/storage/PhabricatorProfilePanelConfiguration.php', - 'PhabricatorProfilePanelConfigurationQuery' => 'applications/search/query/PhabricatorProfilePanelConfigurationQuery.php', - 'PhabricatorProfilePanelConfigurationTransaction' => 'applications/search/storage/PhabricatorProfilePanelConfigurationTransaction.php', - 'PhabricatorProfilePanelConfigurationTransactionQuery' => 'applications/search/query/PhabricatorProfilePanelConfigurationTransactionQuery.php', - 'PhabricatorProfilePanelEditor' => 'applications/search/editor/PhabricatorProfilePanelEditor.php', 'PhabricatorProfilePanelIconSet' => 'applications/search/profilepanel/PhabricatorProfilePanelIconSet.php', - 'PhabricatorProfilePanelPHIDType' => 'applications/search/phidtype/PhabricatorProfilePanelPHIDType.php', 'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php', 'PhabricatorProjectAddHeraldAction' => 'applications/project/herald/PhabricatorProjectAddHeraldAction.php', 'PhabricatorProjectApplication' => 'applications/project/application/PhabricatorProjectApplication.php', @@ -8451,20 +8451,20 @@ phutil_register_library_map(array( 'PhabricatorPonderApplication' => 'PhabricatorApplication', 'PhabricatorProfileMenuCollapsedSetting' => 'PhabricatorInternalSetting', 'PhabricatorProfileMenuEditEngine' => 'PhabricatorEditEngine', + 'PhabricatorProfileMenuEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorProfileMenuEngine' => 'Phobject', - 'PhabricatorProfilePanel' => 'Phobject', - 'PhabricatorProfilePanelConfiguration' => array( + 'PhabricatorProfileMenuItemConfiguration' => array( 'PhabricatorSearchDAO', 'PhabricatorPolicyInterface', 'PhabricatorExtendedPolicyInterface', 'PhabricatorApplicationTransactionInterface', ), - 'PhabricatorProfilePanelConfigurationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhabricatorProfilePanelConfigurationTransaction' => 'PhabricatorApplicationTransaction', - 'PhabricatorProfilePanelConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery', - 'PhabricatorProfilePanelEditor' => 'PhabricatorApplicationTransactionEditor', + 'PhabricatorProfileMenuItemConfigurationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', + 'PhabricatorProfileMenuItemConfigurationTransaction' => 'PhabricatorApplicationTransaction', + 'PhabricatorProfileMenuItemConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery', + 'PhabricatorProfileMenuItemPHIDType' => 'PhabricatorPHIDType', + 'PhabricatorProfilePanel' => 'Phobject', 'PhabricatorProfilePanelIconSet' => 'PhabricatorIconSet', - 'PhabricatorProfilePanelPHIDType' => 'PhabricatorPHIDType', 'PhabricatorProject' => array( 'PhabricatorProjectDAO', 'PhabricatorApplicationTransactionInterface', diff --git a/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php index 847c20389c..5d26d25cbb 100644 --- a/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php +++ b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php @@ -24,7 +24,7 @@ final class PhabricatorPeopleProfileMenuEngine $panels[] = $this->newPanel() ->setBuiltinKey(self::PANEL_PROFILE) - ->setPanelKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY); + ->setMenuItemKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY); $have_maniphest = PhabricatorApplication::isClassInstalledForViewer( 'PhabricatorManiphestApplication', @@ -36,10 +36,10 @@ final class PhabricatorPeopleProfileMenuEngine $panels[] = $this->newPanel() ->setBuiltinKey('tasks') - ->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) - ->setPanelProperty('icon', 'maniphest') - ->setPanelProperty('name', pht('Open Tasks')) - ->setPanelProperty('uri', $uri); + ->setMenuItemKey(PhabricatorLinkProfilePanel::PANELKEY) + ->setMenuItemProperty('icon', 'maniphest') + ->setMenuItemProperty('name', pht('Open Tasks')) + ->setMenuItemProperty('uri', $uri); } $have_differential = PhabricatorApplication::isClassInstalledForViewer( @@ -52,10 +52,10 @@ final class PhabricatorPeopleProfileMenuEngine $panels[] = $this->newPanel() ->setBuiltinKey('revisions') - ->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) - ->setPanelProperty('icon', 'differential') - ->setPanelProperty('name', pht('Revisions')) - ->setPanelProperty('uri', $uri); + ->setMenuItemKey(PhabricatorLinkProfilePanel::PANELKEY) + ->setMenuItemProperty('icon', 'differential') + ->setMenuItemProperty('name', pht('Revisions')) + ->setMenuItemProperty('uri', $uri); } $have_diffusion = PhabricatorApplication::isClassInstalledForViewer( @@ -68,15 +68,15 @@ final class PhabricatorPeopleProfileMenuEngine $panels[] = $this->newPanel() ->setBuiltinKey('commits') - ->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) - ->setPanelProperty('icon', 'diffusion') - ->setPanelProperty('name', pht('Commits')) - ->setPanelProperty('uri', $uri); + ->setMenuItemKey(PhabricatorLinkProfilePanel::PANELKEY) + ->setMenuItemProperty('icon', 'diffusion') + ->setMenuItemProperty('name', pht('Commits')) + ->setMenuItemProperty('uri', $uri); } $panels[] = $this->newPanel() ->setBuiltinKey(self::PANEL_MANAGE) - ->setPanelKey(PhabricatorPeopleManageProfilePanel::PANELKEY); + ->setMenuItemKey(PhabricatorPeopleManageProfilePanel::PANELKEY); return $panels; } diff --git a/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php b/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php index 83d45dfb9d..969d42f73c 100644 --- a/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php +++ b/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php @@ -14,8 +14,8 @@ final class PhabricatorPeopleDetailsProfilePanel } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -25,18 +25,18 @@ final class PhabricatorPeopleDetailsProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setPlaceholder($this->getDefaultName()) - ->setValue($config->getPanelProperty('name')), + ->setValue($config->getMenuProperty('name')), ); } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $user = $config->getProfileObject(); diff --git a/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php b/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php index 29000b5a94..ffaf6b675d 100644 --- a/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php +++ b/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php @@ -14,13 +14,13 @@ final class PhabricatorPeopleManageProfilePanel } public function canHidePanel( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return false; } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -30,18 +30,18 @@ final class PhabricatorPeopleManageProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setPlaceholder($this->getDefaultName()) - ->setValue($config->getPanelProperty('name')), + ->setValue($config->getMenuItemProperty('name')), ); } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $user = $config->getProfileObject(); $id = $user->getID(); diff --git a/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php b/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php index 0c43a22a54..5b6133b3a1 100644 --- a/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php +++ b/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php @@ -18,27 +18,27 @@ final class PhabricatorProjectProfileMenuEngine $panels[] = $this->newPanel() ->setBuiltinKey(PhabricatorProject::PANEL_PROFILE) - ->setPanelKey(PhabricatorProjectDetailsProfilePanel::PANELKEY); + ->setMenuItemKey(PhabricatorProjectDetailsProfilePanel::PANELKEY); $panels[] = $this->newPanel() ->setBuiltinKey(PhabricatorProject::PANEL_POINTS) - ->setPanelKey(PhabricatorProjectPointsProfilePanel::PANELKEY); + ->setMenuItemKey(PhabricatorProjectPointsProfilePanel::PANELKEY); $panels[] = $this->newPanel() ->setBuiltinKey(PhabricatorProject::PANEL_WORKBOARD) - ->setPanelKey(PhabricatorProjectWorkboardProfilePanel::PANELKEY); + ->setMenuItemKey(PhabricatorProjectWorkboardProfilePanel::PANELKEY); $panels[] = $this->newPanel() ->setBuiltinKey(PhabricatorProject::PANEL_MEMBERS) - ->setPanelKey(PhabricatorProjectMembersProfilePanel::PANELKEY); + ->setMenuItemKey(PhabricatorProjectMembersProfilePanel::PANELKEY); $panels[] = $this->newPanel() ->setBuiltinKey(PhabricatorProject::PANEL_SUBPROJECTS) - ->setPanelKey(PhabricatorProjectSubprojectsProfilePanel::PANELKEY); + ->setMenuItemKey(PhabricatorProjectSubprojectsProfilePanel::PANELKEY); $panels[] = $this->newPanel() ->setBuiltinKey(PhabricatorProject::PANEL_MANAGE) - ->setPanelKey(PhabricatorProjectManageProfilePanel::PANELKEY); + ->setMenuItemKey(PhabricatorProjectManageProfilePanel::PANELKEY); return $panels; } diff --git a/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php index 07e6ce4c10..9e8c508bb7 100644 --- a/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php @@ -14,13 +14,13 @@ final class PhabricatorProjectDetailsProfilePanel } public function canMakeDefault( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return true; } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -30,18 +30,18 @@ final class PhabricatorProjectDetailsProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setPlaceholder($this->getDefaultName()) - ->setValue($config->getPanelProperty('name')), + ->setValue($config->getMenuItemProperty('name')), ); } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $project = $config->getProfileObject(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php index ae66c4cc3e..391cd2437b 100644 --- a/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php @@ -14,18 +14,18 @@ final class PhabricatorProjectManageProfilePanel } public function canHidePanel( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return false; } public function canMakeDefault( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return true; } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -35,18 +35,18 @@ final class PhabricatorProjectManageProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setPlaceholder($this->getDefaultName()) - ->setValue($config->getPanelProperty('name')), + ->setValue($config->getMenuItemProperty('name')), ); } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $project = $config->getProfileObject(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectMembersProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectMembersProfilePanel.php index b5374416aa..640313af0a 100644 --- a/src/applications/project/profilepanel/PhabricatorProjectMembersProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectMembersProfilePanel.php @@ -14,8 +14,8 @@ final class PhabricatorProjectMembersProfilePanel } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -25,18 +25,18 @@ final class PhabricatorProjectMembersProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setPlaceholder($this->getDefaultName()) - ->setValue($config->getPanelProperty('name')), + ->setValue($config->getMenuItemProperty('name')), ); } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $project = $config->getProfileObject(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php index 02a2f3984f..33333fdbf4 100644 --- a/src/applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php @@ -36,12 +36,12 @@ final class PhabricatorProjectPointsProfilePanel } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return $this->getDefaultName(); } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorInstructionsEditField()) ->setValue( @@ -53,7 +53,7 @@ final class PhabricatorProjectPointsProfilePanel } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $viewer = $this->getViewer(); $project = $config->getProfileObject(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php index 342c8025aa..7ea124bd9f 100644 --- a/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php @@ -22,8 +22,8 @@ final class PhabricatorProjectSubprojectsProfilePanel } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -33,18 +33,18 @@ final class PhabricatorProjectSubprojectsProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setPlaceholder($this->getDefaultName()) - ->setValue($config->getPanelProperty('name')), + ->setValue($config->getMenuItemProperty('name')), ); } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $project = $config->getProfileObject(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php index 8bfeeb4cfe..1eac36c31a 100644 --- a/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php @@ -14,7 +14,7 @@ final class PhabricatorProjectWorkboardProfilePanel } public function canMakeDefault( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return true; } @@ -31,8 +31,8 @@ final class PhabricatorProjectWorkboardProfilePanel } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -42,18 +42,18 @@ final class PhabricatorProjectWorkboardProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setPlaceholder($this->getDefaultName()) - ->setValue($config->getPanelProperty('name')), + ->setValue($config->getMenuItemProperty('name')), ); } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $project = $config->getProfileObject(); $has_workboard = $project->getHasWorkboard(); diff --git a/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php b/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php index 1cbd4dc3fb..b2486b7b43 100644 --- a/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php +++ b/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php @@ -33,7 +33,7 @@ final class PhabricatorProfileMenuEditEngine } public function setNewPanelConfiguration( - PhabricatorProfilePanelConfiguration $configuration) { + PhabricatorProfileMenuItemConfiguration $configuration) { $this->newPanelConfiguration = $configuration; return $this; } @@ -77,7 +77,7 @@ final class PhabricatorProfileMenuEditEngine } protected function newObjectQuery() { - return id(new PhabricatorProfilePanelConfigurationQuery()); + return id(new PhabricatorProfileMenuItemConfigurationQuery()); } protected function getObjectCreateTitleText($object) { @@ -125,7 +125,7 @@ final class PhabricatorProfileMenuEditEngine $fields = $panel->buildEditEngineFields($object); $type_property = - PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY; + PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY; foreach ($fields as $field) { $field diff --git a/src/applications/search/editor/PhabricatorProfilePanelEditor.php b/src/applications/search/editor/PhabricatorProfileMenuEditor.php similarity index 52% rename from src/applications/search/editor/PhabricatorProfilePanelEditor.php rename to src/applications/search/editor/PhabricatorProfileMenuEditor.php index ce4dbeb8f0..673e8728a9 100644 --- a/src/applications/search/editor/PhabricatorProfilePanelEditor.php +++ b/src/applications/search/editor/PhabricatorProfileMenuEditor.php @@ -1,6 +1,6 @@ getTransactionType()) { - case PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY: + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY: $key = $xaction->getMetadataValue('property.key'); - return $object->getPanelProperty($key, null); - case PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER: - return $object->getPanelOrder(); - case PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY: + return $object->getMenuItemProperty($key, null); + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER: + return $object->getMenuItemOrder(); + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY: return $object->getVisibility(); } } @@ -41,10 +44,10 @@ final class PhabricatorProfilePanelEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY: - case PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY: + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY: + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY: return $xaction->getNewValue(); - case PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER: + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER: return (int)$xaction->getNewValue(); } } @@ -54,15 +57,15 @@ final class PhabricatorProfilePanelEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY: + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY: $key = $xaction->getMetadataValue('property.key'); $value = $xaction->getNewValue(); - $object->setPanelProperty($key, $value); + $object->getMenuItemProperty($key, $value); return; - case PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER: - $object->setPanelOrder($xaction->getNewValue()); + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER: + $object->setMenuItemOrder($xaction->getNewValue()); return; - case PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY: + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY: $object->setVisibility($xaction->getNewValue()); return; } @@ -75,9 +78,9 @@ final class PhabricatorProfilePanelEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY: - case PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER: - case PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY: + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY: + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER: + case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY: return; } diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php index 55b8f1771b..2f9f17ae32 100644 --- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -37,7 +37,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } private function setDefaultPanel( - PhabricatorProfilePanelConfiguration $default_panel) { + PhabricatorProfileMenuItemConfiguration $default_panel) { $this->defaultPanel = $default_panel; return $this; } @@ -231,7 +231,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $panels = $this->loadBuiltinProfilePanels(); - $stored_panels = id(new PhabricatorProfilePanelConfigurationQuery()) + $stored_panels = id(new PhabricatorProfileMenuItemConfigurationQuery()) ->setViewer($viewer) ->withProfilePHIDs(array($object->getPHID())) ->execute(); @@ -327,7 +327,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $builtin_key)); } - $panel_key = $builtin->getPanelKey(); + $panel_key = $builtin->getMenuItemKey(); $panel = idx($panels, $panel_key); if (!$panel) { @@ -346,7 +346,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->setProfilePHID($object->getPHID()) ->attachPanel($panel) ->attachProfileObject($object) - ->setPanelOrder($order); + ->setMenuItemOrder($order); if (!$builtin->shouldEnableForObject($object)) { continue; @@ -488,17 +488,17 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $panels = array_select_keys($panels, $key_order) + $panels; $type_order = - PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER; + PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER; $order = 1; foreach ($panels as $panel) { $xactions = array(); - $xactions[] = id(new PhabricatorProfilePanelConfigurationTransaction()) + $xactions[] = id(new PhabricatorProfileMenuItemConfigurationTransaction()) ->setTransactionType($type_order) ->setNewValue($order); - $editor = id(new PhabricatorProfilePanelEditor()) + $editor = id(new PhabricatorProfileMenuEditor()) ->setContentSourceFromRequest($request) ->setActor($viewer) ->setContinueOnMissingFields(true) @@ -607,7 +607,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $hide_text = pht('Delete'); } - $can_disable = $panel->canHidePanel(); + $can_disable = $panel->canHideMenuItem(); $item->addAction( id(new PHUIListItemView()) @@ -695,7 +695,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } $configuration = - PhabricatorProfilePanelConfiguration::initializeNewPanelConfiguration( + PhabricatorProfileMenuItemConfiguration::initializeNewPanelConfiguration( $object, $panel_type); @@ -729,7 +729,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } private function buildPanelBuiltinContent( - PhabricatorProfilePanelConfiguration $configuration) { + PhabricatorProfileMenuItemConfiguration $configuration) { // If this builtin panel has already been persisted, redirect to the // edit page. @@ -761,7 +761,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } private function buildPanelHideContent( - PhabricatorProfilePanelConfiguration $configuration) { + PhabricatorProfileMenuItemConfiguration $configuration) { $controller = $this->getController(); $request = $controller->getRequest(); @@ -772,7 +772,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $configuration, PhabricatorPolicyCapability::CAN_EDIT); - if (!$configuration->canHidePanel()) { + if (!$configuration->canHideMenuItem()) { return $controller->newDialog() ->setTitle(pht('Mandatory Panel')) ->appendParagraph( @@ -787,14 +787,14 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $body = pht('Delete this menu item?'); $button = pht('Delete Menu Item'); } else if ($configuration->isDisabled()) { - $new_value = PhabricatorProfilePanelConfiguration::VISIBILITY_VISIBLE; + $new_value = PhabricatorProfileMenuItemConfiguration::VISIBILITY_VISIBLE; $title = pht('Enable Menu Item'); $body = pht( 'Enable this menu item? It will appear in the menu again.'); $button = pht('Enable Menu Item'); } else { - $new_value = PhabricatorProfilePanelConfiguration::VISIBILITY_DISABLED; + $new_value = PhabricatorProfileMenuItemConfiguration::VISIBILITY_DISABLED; $title = pht('Disable Menu Item'); $body = pht( @@ -809,15 +809,16 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $configuration->delete(); } else { $type_visibility = - PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY; + PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY; $xactions = array(); - $xactions[] = id(new PhabricatorProfilePanelConfigurationTransaction()) - ->setTransactionType($type_visibility) - ->setNewValue($new_value); + $xactions[] = + id(new PhabricatorProfileMenuItemConfigurationTransaction()) + ->setTransactionType($type_visibility) + ->setNewValue($new_value); - $editor = id(new PhabricatorProfilePanelEditor()) + $editor = id(new PhabricatorProfileMenuEditor()) ->setContentSourceFromRequest($request) ->setActor($viewer) ->setContinueOnMissingFields(true) @@ -837,7 +838,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } private function buildPanelDefaultContent( - PhabricatorProfilePanelConfiguration $configuration, + PhabricatorProfileMenuItemConfiguration $configuration, array $panels) { $controller = $this->getController(); @@ -894,7 +895,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } protected function newPanel() { - return PhabricatorProfilePanelConfiguration::initializeNewBuiltin(); + return PhabricatorProfileMenuItemConfiguration::initializeNewBuiltin(); } public function adjustDefault($key) { @@ -931,10 +932,10 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } $type_visibility = - PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY; + PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY; - $v_visible = PhabricatorProfilePanelConfiguration::VISIBILITY_VISIBLE; - $v_default = PhabricatorProfilePanelConfiguration::VISIBILITY_DEFAULT; + $v_visible = PhabricatorProfileMenuItemConfiguration::VISIBILITY_VISIBLE; + $v_default = PhabricatorProfileMenuItemConfiguration::VISIBILITY_DEFAULT; $apply = array( array($v_visible, $visible), @@ -946,11 +947,12 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { foreach ($panels as $panel) { $xactions = array(); - $xactions[] = id(new PhabricatorProfilePanelConfigurationTransaction()) - ->setTransactionType($type_visibility) - ->setNewValue($value); + $xactions[] = + id(new PhabricatorProfileMenuItemConfigurationTransaction()) + ->setTransactionType($type_visibility) + ->setNewValue($value); - $editor = id(new PhabricatorProfilePanelEditor()) + $editor = id(new PhabricatorProfileMenuEditor()) ->setContentSourceFromRequest($request) ->setActor($viewer) ->setContinueOnMissingFields(true) diff --git a/src/applications/search/phidtype/PhabricatorProfilePanelPHIDType.php b/src/applications/search/phidtype/PhabricatorProfileMenuItemPHIDType.php similarity index 69% rename from src/applications/search/phidtype/PhabricatorProfilePanelPHIDType.php rename to src/applications/search/phidtype/PhabricatorProfileMenuItemPHIDType.php index e2285e2543..0fbdcaca48 100644 --- a/src/applications/search/phidtype/PhabricatorProfilePanelPHIDType.php +++ b/src/applications/search/phidtype/PhabricatorProfileMenuItemPHIDType.php @@ -1,16 +1,16 @@ withPHIDs($phids); } @@ -32,7 +32,7 @@ final class PhabricatorProfilePanelPHIDType foreach ($handles as $phid => $handle) { $config = $objects[$phid]; - $handle->setName(pht('Profile Panel')); + $handle->setName(pht('Profile Menu Item')); } } diff --git a/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php b/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php index f2d53f936d..1486f5309e 100644 --- a/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php @@ -18,7 +18,7 @@ final class PhabricatorApplicationProfilePanel } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $app = $this->getApplication($config); if ($app) { return $app->getName(); @@ -29,20 +29,20 @@ final class PhabricatorApplicationProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorDatasourceEditField()) ->setKey('application') ->setLabel(pht('Application')) ->setDatasource(new PhabricatorApplicationDatasource()) - ->setSingleValue($config->getPanelProperty('application')), + ->setSingleValue($config->getMenuItemProperty('application')), ); } private function getApplication( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $viewer = $this->getViewer(); - $phid = $config->getPanelProperty('application'); + $phid = $config->getMenuItemProperty('application'); $app = id(new PhabricatorApplicationQuery()) ->setViewer($viewer) ->withPHIDs(array($phid)) @@ -52,7 +52,7 @@ final class PhabricatorApplicationProfilePanel } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $viewer = $this->getViewer(); $app = $this->getApplication($config); if (!$app) { diff --git a/src/applications/search/profilepanel/PhabricatorDividerProfilePanel.php b/src/applications/search/profilepanel/PhabricatorDividerProfilePanel.php index 1458cac56c..e10dd8fbf7 100644 --- a/src/applications/search/profilepanel/PhabricatorDividerProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorDividerProfilePanel.php @@ -18,12 +18,12 @@ final class PhabricatorDividerProfilePanel } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return pht("\xE2\x80\x94"); } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorInstructionsEditField()) ->setValue( @@ -35,7 +35,7 @@ final class PhabricatorDividerProfilePanel } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $item = $this->newItem() ->addClass('phui-divider'); diff --git a/src/applications/search/profilepanel/PhabricatorLinkProfilePanel.php b/src/applications/search/profilepanel/PhabricatorLinkProfilePanel.php index 18654dccd3..56041f9cfe 100644 --- a/src/applications/search/profilepanel/PhabricatorLinkProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorLinkProfilePanel.php @@ -18,12 +18,12 @@ final class PhabricatorLinkProfilePanel } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return $this->getLinkName($config); } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') @@ -44,18 +44,18 @@ final class PhabricatorLinkProfilePanel } private function getLinkName( - PhabricatorProfilePanelConfiguration $config) { - return $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + return $config->getMenuItemProperty('name'); } private function getLinkIcon( - PhabricatorProfilePanelConfiguration $config) { - return $config->getPanelProperty('icon', 'link'); + PhabricatorProfileMenuItemConfiguration $config) { + return $config->getMenuItemProperty('icon', 'link'); } private function getLinkURI( - PhabricatorProfilePanelConfiguration $config) { - return $config->getPanelProperty('uri'); + PhabricatorProfileMenuItemConfiguration $config) { + return $config->getMenuItemProperty('uri'); } private function isValidLinkURI($uri) { @@ -63,7 +63,7 @@ final class PhabricatorLinkProfilePanel } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $icon = $this->getLinkIcon($config); $name = $this->getLinkName($config); diff --git a/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php b/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php index 5a645039ec..cbdeb4fe0e 100644 --- a/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php @@ -18,10 +18,10 @@ final class PhabricatorMotivatorProfilePanel } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $options = $this->getOptions(); - $name = idx($options, $config->getPanelProperty('source')); + $name = idx($options, $config->getMenuItemProperty('source')); if ($name !== null) { return pht('Motivator: %s', $name); } else { @@ -30,7 +30,7 @@ final class PhabricatorMotivatorProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorInstructionsEditField()) ->setValue( @@ -51,9 +51,9 @@ final class PhabricatorMotivatorProfilePanel } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { - $source = $config->getPanelProperty('source'); + $source = $config->getMenuItemProperty('source'); switch ($source) { case 'catfacts': diff --git a/src/applications/search/profilepanel/PhabricatorProfilePanel.php b/src/applications/search/profilepanel/PhabricatorProfilePanel.php index 8fcbd3f96a..48b42808f8 100644 --- a/src/applications/search/profilepanel/PhabricatorProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorProfilePanel.php @@ -5,12 +5,12 @@ abstract class PhabricatorProfilePanel extends Phobject { private $viewer; final public function buildNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return $this->newNavigationMenuItems($config); } abstract protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config); + PhabricatorProfileMenuItemConfiguration $config); public function getPanelTypeIcon() { return null; @@ -19,10 +19,10 @@ abstract class PhabricatorProfilePanel extends Phobject { abstract public function getPanelTypeName(); abstract public function getDisplayName( - PhabricatorProfilePanelConfiguration $config); + PhabricatorProfileMenuItemConfiguration $config); public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array(); } @@ -35,12 +35,12 @@ abstract class PhabricatorProfilePanel extends Phobject { } public function canHidePanel( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return true; } public function canMakeDefault( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return false; } diff --git a/src/applications/search/query/PhabricatorProfilePanelConfigurationQuery.php b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php similarity index 92% rename from src/applications/search/query/PhabricatorProfilePanelConfigurationQuery.php rename to src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php index 52e12581cf..60aeb3d619 100644 --- a/src/applications/search/query/PhabricatorProfilePanelConfigurationQuery.php +++ b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php @@ -1,6 +1,6 @@ $panel) { - $panel_type = idx($panels, $panel->getPanelKey()); + $panel_type = idx($panels, $panel->getMenuItemKey()); if (!$panel_type) { $this->didRejectResult($panel); unset($page[$key]); diff --git a/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php new file mode 100644 index 0000000000..0023660512 --- /dev/null +++ b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php @@ -0,0 +1,10 @@ +setVisibility(self::VISIBILITY_VISIBLE); @@ -32,7 +37,7 @@ final class PhabricatorProfilePanelConfiguration return self::initializeNewBuiltin() ->setProfilePHID($profile_object->getPHID()) - ->setPanelKey($panel->getPanelKey()) + ->setMenuItemKey($panel->getPanelKey()) ->attachPanel($panel) ->attachProfileObject($profile_object); } @@ -41,17 +46,17 @@ final class PhabricatorProfilePanelConfiguration return array( self::CONFIG_AUX_PHID => true, self::CONFIG_SERIALIZATION => array( - 'panelProperties' => self::SERIALIZATION_JSON, + 'menuItemProperties' => self::SERIALIZATION_JSON, ), self::CONFIG_COLUMN_SCHEMA => array( - 'panelKey' => 'text64', + 'menuItemKey' => 'text64', 'builtinKey' => 'text64?', - 'panelOrder' => 'uint32?', + 'menuItemOrder' => 'uint32?', 'visibility' => 'text32', ), self::CONFIG_KEY_SCHEMA => array( 'key_profile' => array( - 'columns' => array('profilePHID', 'panelOrder'), + 'columns' => array('profilePHID', 'menuItemOrder'), ), ), ) + parent::getConfiguration(); @@ -59,7 +64,7 @@ final class PhabricatorProfilePanelConfiguration public function generatePHID() { return PhabricatorPHID::generateNewPHID( - PhabricatorProfilePanelPHIDType::TYPECONST); + PhabricatorProfileMenuItemPHIDType::TYPECONST); } public function attachPanel(PhabricatorProfilePanel $panel) { @@ -80,13 +85,13 @@ final class PhabricatorProfilePanelConfiguration return $this->assertAttached($this->profileObject); } - public function setPanelProperty($key, $value) { - $this->panelProperties[$key] = $value; + public function setMenuItemProperty($key, $value) { + $this->menuItemProperties[$key] = $value; return $this; } - public function getPanelProperty($key, $default = null) { - return idx($this->panelProperties, $key, $default); + public function getMenuItemProperty($key, $default = null) { + return idx($this->menuItemProperties, $key, $default); } public function buildNavigationMenuItems() { @@ -105,7 +110,7 @@ final class PhabricatorProfilePanelConfiguration return $this->getPanel()->canMakeDefault($this); } - public function canHidePanel() { + public function canHideMenuItem() { return $this->getPanel()->canHidePanel($this); } @@ -114,7 +119,7 @@ final class PhabricatorProfilePanelConfiguration } public function getSortKey() { - $order = $this->getPanelOrder(); + $order = $this->getMenuItemOrder(); if ($order === null) { $order = 'Z'; } else { @@ -128,7 +133,7 @@ final class PhabricatorProfilePanelConfiguration } public function isDisabled() { - if (!$this->canHidePanel()) { + if (!$this->canHideMenuItem()) { return false; } return ($this->getVisibility() === self::VISIBILITY_DISABLED); @@ -179,7 +184,7 @@ final class PhabricatorProfilePanelConfiguration public function getApplicationTransactionEditor() { - return new PhabricatorProfilePanelEditor(); + return new PhabricatorProfileMenuEditor(); } public function getApplicationTransactionObject() { @@ -187,7 +192,7 @@ final class PhabricatorProfilePanelConfiguration } public function getApplicationTransactionTemplate() { - return new PhabricatorProfilePanelConfigurationTransaction(); + return new PhabricatorProfileMenuItemConfigurationTransaction(); } public function willRenderTimeline( diff --git a/src/applications/search/storage/PhabricatorProfilePanelConfigurationTransaction.php b/src/applications/search/storage/PhabricatorProfileMenuItemConfigurationTransaction.php similarity index 59% rename from src/applications/search/storage/PhabricatorProfilePanelConfigurationTransaction.php rename to src/applications/search/storage/PhabricatorProfileMenuItemConfigurationTransaction.php index 28181cb217..b1d30a5b9d 100644 --- a/src/applications/search/storage/PhabricatorProfilePanelConfigurationTransaction.php +++ b/src/applications/search/storage/PhabricatorProfileMenuItemConfigurationTransaction.php @@ -1,6 +1,6 @@ buildEdgeSchemata(new PhabricatorProfilePanelConfiguration()); + $this->buildEdgeSchemata(new PhabricatorProfileMenuItemConfiguration()); $this->buildRawSchema( 'search', diff --git a/src/applications/settings/controller/PhabricatorSettingsMainController.php b/src/applications/settings/controller/PhabricatorSettingsMainController.php index fada4a0937..4142e61969 100644 --- a/src/applications/settings/controller/PhabricatorSettingsMainController.php +++ b/src/applications/settings/controller/PhabricatorSettingsMainController.php @@ -98,7 +98,7 @@ final class PhabricatorSettingsMainController $panels = $this->buildPanels($preferences); $nav = $this->renderSideNav($panels); - $key = $nav->selectFilter($key, head($panels)->getPanelKey()); + $key = $nav->selectFilter($key, head($panels)->getMenuItemKey()); $panel = $panels[$key] ->setController($this) @@ -196,7 +196,7 @@ final class PhabricatorSettingsMainController $nav->addLabel($group->getPanelGroupName()); } - $nav->addFilter($panel->getPanelKey(), $panel->getPanelName()); + $nav->addFilter($panel->getMenuItemKey(), $panel->getPanelName()); } return $nav; From 42896f9f90442ecb53789769206de62beeab720e Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 11 Dec 2016 10:08:26 -0800 Subject: [PATCH 06/78] Rename all ProfilePanels into ProfileMenuItems Summary: Ref T11957. Test Plan: - Viewed an existing project profile. - Viewed a user profile. - Created a new project. - Edited a profile menu. - Added new profile items. - Grepped for renamed symbols. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11957 Differential Revision: https://secure.phabricator.com/D17028 --- src/__phutil_library_map__.php | 60 +-- .../base/PhabricatorApplication.php | 18 +- .../PhabricatorPeopleApplication.php | 4 +- ...PhabricatorPeopleProfileEditController.php | 2 +- ...abricatorPeopleProfileManageController.php | 2 +- ...bricatorPeopleProfilePictureController.php | 2 +- ...PhabricatorPeopleProfileViewController.php | 2 +- .../PhabricatorPeopleProfileMenuEngine.php | 38 +- ...abricatorPeopleDetailsProfileMenuItem.php} | 8 +- ...habricatorPeopleManageProfileMenuItem.php} | 10 +- .../PhabricatorProjectApplication.php | 4 +- .../PhabricatorProjectBoardController.php | 2 +- .../PhabricatorProjectBoardViewController.php | 4 +- ...habricatorProjectEditPictureController.php | 2 +- .../PhabricatorProjectManageController.php | 4 +- ...habricatorProjectMembersViewController.php | 2 +- ... PhabricatorProjectMenuItemController.php} | 2 +- .../PhabricatorProjectProfileController.php | 2 +- ...habricatorProjectSubprojectsController.php | 2 +- .../PhabricatorProjectViewController.php | 6 +- .../PhabricatorProjectProfileMenuEngine.php | 47 +-- ...bricatorProjectDetailsProfileMenuItem.php} | 8 +- ...abricatorProjectManageProfileMenuItem.php} | 10 +- ...bricatorProjectMembersProfileMenuItem.php} | 8 +- ...abricatorProjectPointsProfileMenuItem.php} | 8 +- ...atorProjectSubprojectsProfileMenuItem.php} | 8 +- ...icatorProjectWorkboardProfileMenuItem.php} | 8 +- .../project/storage/PhabricatorProject.php | 14 +- .../PhabricatorProfileMenuEditEngine.php | 26 +- .../editor/PhabricatorProfileMenuEditor.php | 2 +- .../engine/PhabricatorProfileMenuEngine.php | 342 +++++++++--------- ...PhabricatorApplicationProfileMenuItem.php} | 10 +- .../PhabricatorDividerProfileMenuItem.php} | 10 +- .../PhabricatorLinkProfileMenuItem.php} | 14 +- .../PhabricatorMotivatorProfileMenuItem.php} | 12 +- .../PhabricatorProfileMenuItem.php} | 16 +- .../PhabricatorProfileMenuItemIconSet.php} | 4 +- ...catorProfileMenuItemConfigurationQuery.php | 20 +- ...habricatorProfileMenuItemConfiguration.php | 32 +- src/docs/user/userguide/profile_menu.diviner | 2 +- 40 files changed, 389 insertions(+), 388 deletions(-) rename src/applications/people/{profilepanel/PhabricatorPeopleDetailsProfilePanel.php => menuitem/PhabricatorPeopleDetailsProfileMenuItem.php} (86%) rename src/applications/people/{profilepanel/PhabricatorPeopleManageProfilePanel.php => menuitem/PhabricatorPeopleManageProfileMenuItem.php} (84%) rename src/applications/project/controller/{PhabricatorProjectPanelController.php => PhabricatorProjectMenuItemController.php} (90%) rename src/applications/project/{profilepanel/PhabricatorProjectDetailsProfilePanel.php => menuitem/PhabricatorProjectDetailsProfileMenuItem.php} (87%) rename src/applications/project/{profilepanel/PhabricatorProjectManageProfilePanel.php => menuitem/PhabricatorProjectManageProfileMenuItem.php} (86%) rename src/applications/project/{profilepanel/PhabricatorProjectMembersProfilePanel.php => menuitem/PhabricatorProjectMembersProfileMenuItem.php} (86%) rename src/applications/project/{profilepanel/PhabricatorProjectPointsProfilePanel.php => menuitem/PhabricatorProjectPointsProfileMenuItem.php} (96%) rename src/applications/project/{profilepanel/PhabricatorProjectSubprojectsProfilePanel.php => menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php} (88%) rename src/applications/project/{profilepanel/PhabricatorProjectWorkboardProfilePanel.php => menuitem/PhabricatorProjectWorkboardProfileMenuItem.php} (90%) rename src/applications/search/{profilepanel/PhabricatorApplicationProfilePanel.php => menuitem/PhabricatorApplicationProfileMenuItem.php} (89%) rename src/applications/search/{profilepanel/PhabricatorDividerProfilePanel.php => menuitem/PhabricatorDividerProfileMenuItem.php} (80%) rename src/applications/search/{profilepanel/PhabricatorLinkProfilePanel.php => menuitem/PhabricatorLinkProfileMenuItem.php} (86%) rename src/applications/search/{profilepanel/PhabricatorMotivatorProfilePanel.php => menuitem/PhabricatorMotivatorProfileMenuItem.php} (94%) rename src/applications/search/{profilepanel/PhabricatorProfilePanel.php => menuitem/PhabricatorProfileMenuItem.php} (76%) rename src/applications/search/{profilepanel/PhabricatorProfilePanelIconSet.php => menuitem/PhabricatorProfileMenuItemIconSet.php} (94%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index dca347a3e1..f064ab8255 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1787,7 +1787,7 @@ phutil_register_library_map(array( 'PhabricatorApplicationEmailCommandsController' => 'applications/meta/controller/PhabricatorApplicationEmailCommandsController.php', 'PhabricatorApplicationLaunchView' => 'applications/meta/view/PhabricatorApplicationLaunchView.php', 'PhabricatorApplicationPanelController' => 'applications/meta/controller/PhabricatorApplicationPanelController.php', - 'PhabricatorApplicationProfilePanel' => 'applications/search/profilepanel/PhabricatorApplicationProfilePanel.php', + 'PhabricatorApplicationProfileMenuItem' => 'applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php', 'PhabricatorApplicationQuery' => 'applications/meta/query/PhabricatorApplicationQuery.php', 'PhabricatorApplicationSearchController' => 'applications/search/controller/PhabricatorApplicationSearchController.php', 'PhabricatorApplicationSearchEngine' => 'applications/search/engine/PhabricatorApplicationSearchEngine.php', @@ -2505,7 +2505,7 @@ phutil_register_library_map(array( 'PhabricatorDisabledUserController' => 'applications/auth/controller/PhabricatorDisabledUserController.php', 'PhabricatorDisplayPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php', 'PhabricatorDisqusAuthProvider' => 'applications/auth/provider/PhabricatorDisqusAuthProvider.php', - 'PhabricatorDividerProfilePanel' => 'applications/search/profilepanel/PhabricatorDividerProfilePanel.php', + 'PhabricatorDividerProfileMenuItem' => 'applications/search/menuitem/PhabricatorDividerProfileMenuItem.php', 'PhabricatorDivinerApplication' => 'applications/diviner/application/PhabricatorDivinerApplication.php', 'PhabricatorDoorkeeperApplication' => 'applications/doorkeeper/application/PhabricatorDoorkeeperApplication.php', 'PhabricatorDraft' => 'applications/draft/storage/PhabricatorDraft.php', @@ -2828,7 +2828,7 @@ phutil_register_library_map(array( 'PhabricatorLegalpadDocumentPHIDType' => 'applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php', 'PhabricatorLegalpadSignaturePolicyRule' => 'applications/legalpad/policyrule/PhabricatorLegalpadSignaturePolicyRule.php', 'PhabricatorLibraryTestCase' => '__tests__/PhabricatorLibraryTestCase.php', - 'PhabricatorLinkProfilePanel' => 'applications/search/profilepanel/PhabricatorLinkProfilePanel.php', + 'PhabricatorLinkProfileMenuItem' => 'applications/search/menuitem/PhabricatorLinkProfileMenuItem.php', 'PhabricatorLipsumArtist' => 'applications/lipsum/image/PhabricatorLipsumArtist.php', 'PhabricatorLipsumContentSource' => 'infrastructure/contentsource/PhabricatorLipsumContentSource.php', 'PhabricatorLipsumGenerateWorkflow' => 'applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php', @@ -2966,7 +2966,7 @@ phutil_register_library_map(array( 'PhabricatorModularTransactionType' => 'applications/transactions/storage/PhabricatorModularTransactionType.php', 'PhabricatorMonospacedFontSetting' => 'applications/settings/setting/PhabricatorMonospacedFontSetting.php', 'PhabricatorMonospacedTextareasSetting' => 'applications/settings/setting/PhabricatorMonospacedTextareasSetting.php', - 'PhabricatorMotivatorProfilePanel' => 'applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php', + 'PhabricatorMotivatorProfileMenuItem' => 'applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php', 'PhabricatorMultiColumnUIExample' => 'applications/uiexample/examples/PhabricatorMultiColumnUIExample.php', 'PhabricatorMultiFactorSettingsPanel' => 'applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php', 'PhabricatorMultimeterApplication' => 'applications/multimeter/application/PhabricatorMultimeterApplication.php', @@ -3244,7 +3244,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleCreateGuidanceContext' => 'applications/people/guidance/PhabricatorPeopleCreateGuidanceContext.php', 'PhabricatorPeopleDatasource' => 'applications/people/typeahead/PhabricatorPeopleDatasource.php', 'PhabricatorPeopleDeleteController' => 'applications/people/controller/PhabricatorPeopleDeleteController.php', - 'PhabricatorPeopleDetailsProfilePanel' => 'applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php', + 'PhabricatorPeopleDetailsProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php', 'PhabricatorPeopleDisableController' => 'applications/people/controller/PhabricatorPeopleDisableController.php', 'PhabricatorPeopleEmpowerController' => 'applications/people/controller/PhabricatorPeopleEmpowerController.php', 'PhabricatorPeopleExternalPHIDType' => 'applications/people/phid/PhabricatorPeopleExternalPHIDType.php', @@ -3258,7 +3258,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleLogSearchEngine' => 'applications/people/query/PhabricatorPeopleLogSearchEngine.php', 'PhabricatorPeopleLogsController' => 'applications/people/controller/PhabricatorPeopleLogsController.php', 'PhabricatorPeopleMainMenuBarExtension' => 'applications/people/extension/PhabricatorPeopleMainMenuBarExtension.php', - 'PhabricatorPeopleManageProfilePanel' => 'applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php', + 'PhabricatorPeopleManageProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php', 'PhabricatorPeopleNewController' => 'applications/people/controller/PhabricatorPeopleNewController.php', 'PhabricatorPeopleNoOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php', 'PhabricatorPeopleOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleOwnerDatasource.php', @@ -3367,13 +3367,13 @@ phutil_register_library_map(array( 'PhabricatorProfileMenuEditEngine' => 'applications/search/editor/PhabricatorProfileMenuEditEngine.php', 'PhabricatorProfileMenuEditor' => 'applications/search/editor/PhabricatorProfileMenuEditor.php', 'PhabricatorProfileMenuEngine' => 'applications/search/engine/PhabricatorProfileMenuEngine.php', + 'PhabricatorProfileMenuItem' => 'applications/search/menuitem/PhabricatorProfileMenuItem.php', 'PhabricatorProfileMenuItemConfiguration' => 'applications/search/storage/PhabricatorProfileMenuItemConfiguration.php', 'PhabricatorProfileMenuItemConfigurationQuery' => 'applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php', 'PhabricatorProfileMenuItemConfigurationTransaction' => 'applications/search/storage/PhabricatorProfileMenuItemConfigurationTransaction.php', 'PhabricatorProfileMenuItemConfigurationTransactionQuery' => 'applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php', + 'PhabricatorProfileMenuItemIconSet' => 'applications/search/menuitem/PhabricatorProfileMenuItemIconSet.php', 'PhabricatorProfileMenuItemPHIDType' => 'applications/search/phidtype/PhabricatorProfileMenuItemPHIDType.php', - 'PhabricatorProfilePanel' => 'applications/search/profilepanel/PhabricatorProfilePanel.php', - 'PhabricatorProfilePanelIconSet' => 'applications/search/profilepanel/PhabricatorProfilePanelIconSet.php', 'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php', 'PhabricatorProjectAddHeraldAction' => 'applications/project/herald/PhabricatorProjectAddHeraldAction.php', 'PhabricatorProjectApplication' => 'applications/project/application/PhabricatorProjectApplication.php', @@ -3411,7 +3411,7 @@ phutil_register_library_map(array( 'PhabricatorProjectDatasource' => 'applications/project/typeahead/PhabricatorProjectDatasource.php', 'PhabricatorProjectDefaultController' => 'applications/project/controller/PhabricatorProjectDefaultController.php', 'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php', - 'PhabricatorProjectDetailsProfilePanel' => 'applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php', + 'PhabricatorProjectDetailsProfileMenuItem' => 'applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php', 'PhabricatorProjectEditController' => 'applications/project/controller/PhabricatorProjectEditController.php', 'PhabricatorProjectEditEngine' => 'applications/project/engine/PhabricatorProjectEditEngine.php', 'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php', @@ -3432,16 +3432,17 @@ phutil_register_library_map(array( 'PhabricatorProjectLogicalUserDatasource' => 'applications/project/typeahead/PhabricatorProjectLogicalUserDatasource.php', 'PhabricatorProjectLogicalViewerDatasource' => 'applications/project/typeahead/PhabricatorProjectLogicalViewerDatasource.php', 'PhabricatorProjectManageController' => 'applications/project/controller/PhabricatorProjectManageController.php', - 'PhabricatorProjectManageProfilePanel' => 'applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php', + 'PhabricatorProjectManageProfileMenuItem' => 'applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php', 'PhabricatorProjectMaterializedMemberEdgeType' => 'applications/project/edge/PhabricatorProjectMaterializedMemberEdgeType.php', 'PhabricatorProjectMemberListView' => 'applications/project/view/PhabricatorProjectMemberListView.php', 'PhabricatorProjectMemberOfProjectEdgeType' => 'applications/project/edge/PhabricatorProjectMemberOfProjectEdgeType.php', 'PhabricatorProjectMembersAddController' => 'applications/project/controller/PhabricatorProjectMembersAddController.php', 'PhabricatorProjectMembersDatasource' => 'applications/project/typeahead/PhabricatorProjectMembersDatasource.php', 'PhabricatorProjectMembersPolicyRule' => 'applications/project/policyrule/PhabricatorProjectMembersPolicyRule.php', - 'PhabricatorProjectMembersProfilePanel' => 'applications/project/profilepanel/PhabricatorProjectMembersProfilePanel.php', + 'PhabricatorProjectMembersProfileMenuItem' => 'applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php', 'PhabricatorProjectMembersRemoveController' => 'applications/project/controller/PhabricatorProjectMembersRemoveController.php', 'PhabricatorProjectMembersViewController' => 'applications/project/controller/PhabricatorProjectMembersViewController.php', + 'PhabricatorProjectMenuItemController' => 'applications/project/controller/PhabricatorProjectMenuItemController.php', 'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php', 'PhabricatorProjectNameContextFreeGrammar' => 'applications/project/lipsum/PhabricatorProjectNameContextFreeGrammar.php', 'PhabricatorProjectNoProjectsDatasource' => 'applications/project/typeahead/PhabricatorProjectNoProjectsDatasource.php', @@ -3449,8 +3450,7 @@ phutil_register_library_map(array( 'PhabricatorProjectOrUserDatasource' => 'applications/project/typeahead/PhabricatorProjectOrUserDatasource.php', 'PhabricatorProjectOrUserFunctionDatasource' => 'applications/project/typeahead/PhabricatorProjectOrUserFunctionDatasource.php', 'PhabricatorProjectPHIDResolver' => 'applications/phid/resolver/PhabricatorProjectPHIDResolver.php', - 'PhabricatorProjectPanelController' => 'applications/project/controller/PhabricatorProjectPanelController.php', - 'PhabricatorProjectPointsProfilePanel' => 'applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php', + 'PhabricatorProjectPointsProfileMenuItem' => 'applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php', 'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php', 'PhabricatorProjectProfileMenuEngine' => 'applications/project/engine/PhabricatorProjectProfileMenuEngine.php', 'PhabricatorProjectProjectHasMemberEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasMemberEdgeType.php', @@ -3468,7 +3468,7 @@ phutil_register_library_map(array( 'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php', 'PhabricatorProjectSubprojectWarningController' => 'applications/project/controller/PhabricatorProjectSubprojectWarningController.php', 'PhabricatorProjectSubprojectsController' => 'applications/project/controller/PhabricatorProjectSubprojectsController.php', - 'PhabricatorProjectSubprojectsProfilePanel' => 'applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php', + 'PhabricatorProjectSubprojectsProfileMenuItem' => 'applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php', 'PhabricatorProjectTestDataGenerator' => 'applications/project/lipsum/PhabricatorProjectTestDataGenerator.php', 'PhabricatorProjectTransaction' => 'applications/project/storage/PhabricatorProjectTransaction.php', 'PhabricatorProjectTransactionEditor' => 'applications/project/editor/PhabricatorProjectTransactionEditor.php', @@ -3481,7 +3481,7 @@ phutil_register_library_map(array( 'PhabricatorProjectWatchController' => 'applications/project/controller/PhabricatorProjectWatchController.php', 'PhabricatorProjectWatcherListView' => 'applications/project/view/PhabricatorProjectWatcherListView.php', 'PhabricatorProjectWorkboardBackgroundColor' => 'applications/project/constants/PhabricatorProjectWorkboardBackgroundColor.php', - 'PhabricatorProjectWorkboardProfilePanel' => 'applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php', + 'PhabricatorProjectWorkboardProfileMenuItem' => 'applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php', 'PhabricatorProjectsCurtainExtension' => 'applications/project/engineextension/PhabricatorProjectsCurtainExtension.php', 'PhabricatorProjectsEditEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsEditEngineExtension.php', 'PhabricatorProjectsEditField' => 'applications/transactions/editfield/PhabricatorProjectsEditField.php', @@ -6610,7 +6610,7 @@ phutil_register_library_map(array( 'PhabricatorApplicationEmailCommandsController' => 'PhabricatorApplicationsController', 'PhabricatorApplicationLaunchView' => 'AphrontTagView', 'PhabricatorApplicationPanelController' => 'PhabricatorApplicationsController', - 'PhabricatorApplicationProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorApplicationProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorApplicationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorApplicationSearchController' => 'PhabricatorSearchBaseController', 'PhabricatorApplicationSearchEngine' => 'Phobject', @@ -7452,7 +7452,7 @@ phutil_register_library_map(array( 'PhabricatorDisabledUserController' => 'PhabricatorAuthController', 'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 'PhabricatorDisqusAuthProvider' => 'PhabricatorOAuth2AuthProvider', - 'PhabricatorDividerProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorDividerProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorDivinerApplication' => 'PhabricatorApplication', 'PhabricatorDoorkeeperApplication' => 'PhabricatorApplication', 'PhabricatorDraft' => 'PhabricatorDraftDAO', @@ -7820,7 +7820,7 @@ phutil_register_library_map(array( 'PhabricatorLegalpadDocumentPHIDType' => 'PhabricatorPHIDType', 'PhabricatorLegalpadSignaturePolicyRule' => 'PhabricatorPolicyRule', 'PhabricatorLibraryTestCase' => 'PhutilLibraryTestCase', - 'PhabricatorLinkProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorLinkProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorLipsumArtist' => 'Phobject', 'PhabricatorLipsumContentSource' => 'PhabricatorContentSource', 'PhabricatorLipsumGenerateWorkflow' => 'PhabricatorLipsumManagementWorkflow', @@ -7968,7 +7968,7 @@ phutil_register_library_map(array( 'PhabricatorModularTransactionType' => 'Phobject', 'PhabricatorMonospacedFontSetting' => 'PhabricatorStringSetting', 'PhabricatorMonospacedTextareasSetting' => 'PhabricatorSelectSetting', - 'PhabricatorMotivatorProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorMotivatorProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorMultiColumnUIExample' => 'PhabricatorUIExample', 'PhabricatorMultiFactorSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorMultimeterApplication' => 'PhabricatorApplication', @@ -8310,7 +8310,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleCreateGuidanceContext' => 'PhabricatorGuidanceContext', 'PhabricatorPeopleDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorPeopleDeleteController' => 'PhabricatorPeopleController', - 'PhabricatorPeopleDetailsProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorPeopleDetailsProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorPeopleDisableController' => 'PhabricatorPeopleController', 'PhabricatorPeopleEmpowerController' => 'PhabricatorPeopleController', 'PhabricatorPeopleExternalPHIDType' => 'PhabricatorPHIDType', @@ -8324,7 +8324,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleLogSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorPeopleLogsController' => 'PhabricatorPeopleController', 'PhabricatorPeopleMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension', - 'PhabricatorPeopleManageProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorPeopleManageProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorPeopleNewController' => 'PhabricatorPeopleController', 'PhabricatorPeopleNoOwnerDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorPeopleOwnerDatasource' => 'PhabricatorTypeaheadCompositeDatasource', @@ -8453,6 +8453,7 @@ phutil_register_library_map(array( 'PhabricatorProfileMenuEditEngine' => 'PhabricatorEditEngine', 'PhabricatorProfileMenuEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorProfileMenuEngine' => 'Phobject', + 'PhabricatorProfileMenuItem' => 'Phobject', 'PhabricatorProfileMenuItemConfiguration' => array( 'PhabricatorSearchDAO', 'PhabricatorPolicyInterface', @@ -8462,9 +8463,8 @@ phutil_register_library_map(array( 'PhabricatorProfileMenuItemConfigurationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorProfileMenuItemConfigurationTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorProfileMenuItemConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery', + 'PhabricatorProfileMenuItemIconSet' => 'PhabricatorIconSet', 'PhabricatorProfileMenuItemPHIDType' => 'PhabricatorPHIDType', - 'PhabricatorProfilePanel' => 'Phobject', - 'PhabricatorProfilePanelIconSet' => 'PhabricatorIconSet', 'PhabricatorProject' => array( 'PhabricatorProjectDAO', 'PhabricatorApplicationTransactionInterface', @@ -8525,7 +8525,7 @@ phutil_register_library_map(array( 'PhabricatorProjectDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorProjectDefaultController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField', - 'PhabricatorProjectDetailsProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorProjectDetailsProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorProjectEditController' => 'PhabricatorProjectController', 'PhabricatorProjectEditEngine' => 'PhabricatorEditEngine', 'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController', @@ -8545,16 +8545,17 @@ phutil_register_library_map(array( 'PhabricatorProjectLogicalUserDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorProjectLogicalViewerDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorProjectManageController' => 'PhabricatorProjectController', - 'PhabricatorProjectManageProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorProjectManageProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorProjectMaterializedMemberEdgeType' => 'PhabricatorEdgeType', 'PhabricatorProjectMemberListView' => 'PhabricatorProjectUserListView', 'PhabricatorProjectMemberOfProjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorProjectMembersAddController' => 'PhabricatorProjectController', 'PhabricatorProjectMembersDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorProjectMembersPolicyRule' => 'PhabricatorPolicyRule', - 'PhabricatorProjectMembersProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorProjectMembersProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController', 'PhabricatorProjectMembersViewController' => 'PhabricatorProjectController', + 'PhabricatorProjectMenuItemController' => 'PhabricatorProjectController', 'PhabricatorProjectMoveController' => 'PhabricatorProjectController', 'PhabricatorProjectNameContextFreeGrammar' => 'PhutilContextFreeGrammar', 'PhabricatorProjectNoProjectsDatasource' => 'PhabricatorTypeaheadDatasource', @@ -8562,8 +8563,7 @@ phutil_register_library_map(array( 'PhabricatorProjectOrUserDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorProjectOrUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorProjectPHIDResolver' => 'PhabricatorPHIDResolver', - 'PhabricatorProjectPanelController' => 'PhabricatorProjectController', - 'PhabricatorProjectPointsProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorProjectPointsProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorProjectProfileController' => 'PhabricatorProjectController', 'PhabricatorProjectProfileMenuEngine' => 'PhabricatorProfileMenuEngine', 'PhabricatorProjectProjectHasMemberEdgeType' => 'PhabricatorEdgeType', @@ -8584,7 +8584,7 @@ phutil_register_library_map(array( 'PhabricatorProjectStatus' => 'Phobject', 'PhabricatorProjectSubprojectWarningController' => 'PhabricatorProjectController', 'PhabricatorProjectSubprojectsController' => 'PhabricatorProjectController', - 'PhabricatorProjectSubprojectsProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorProjectSubprojectsProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorProjectTestDataGenerator' => 'PhabricatorTestDataGenerator', 'PhabricatorProjectTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorProjectTransactionEditor' => 'PhabricatorApplicationTransactionEditor', @@ -8597,7 +8597,7 @@ phutil_register_library_map(array( 'PhabricatorProjectWatchController' => 'PhabricatorProjectController', 'PhabricatorProjectWatcherListView' => 'PhabricatorProjectUserListView', 'PhabricatorProjectWorkboardBackgroundColor' => 'Phobject', - 'PhabricatorProjectWorkboardProfilePanel' => 'PhabricatorProfilePanel', + 'PhabricatorProjectWorkboardProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorProjectsCurtainExtension' => 'PHUICurtainExtension', 'PhabricatorProjectsEditEngineExtension' => 'PhabricatorEditEngineExtension', 'PhabricatorProjectsEditField' => 'PhabricatorTokenizerEditField', diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php index 89a3c6cb7a..23a759d2aa 100644 --- a/src/applications/base/PhabricatorApplication.php +++ b/src/applications/base/PhabricatorApplication.php @@ -627,18 +627,18 @@ abstract class PhabricatorApplication return $base.'(?:query/(?P[^/]+)/)?'; } - protected function getPanelRouting($controller) { + protected function getProfileMenuRouting($controller) { $edit_route = $this->getEditRoutePattern(); return array( - '(?Pview)/(?P[^/]+)/' => $controller, - '(?Phide)/(?P[^/]+)/' => $controller, - '(?Pdefault)/(?P[^/]+)/' => $controller, - '(?Pconfigure)/' => $controller, - '(?Preorder)/' => $controller, - '(?Pedit)/'.$edit_route => $controller, - '(?Pnew)/(?[^/]+)/'.$edit_route => $controller, - '(?Pbuiltin)/(?[^/]+)/'.$edit_route + '(?Pview)/(?P[^/]+)/' => $controller, + '(?Phide)/(?P[^/]+)/' => $controller, + '(?Pdefault)/(?P[^/]+)/' => $controller, + '(?Pconfigure)/' => $controller, + '(?Preorder)/' => $controller, + '(?Pedit)/'.$edit_route => $controller, + '(?Pnew)/(?[^/]+)/'.$edit_route => $controller, + '(?Pbuiltin)/(?[^/]+)/'.$edit_route => $controller, ); } diff --git a/src/applications/people/application/PhabricatorPeopleApplication.php b/src/applications/people/application/PhabricatorPeopleApplication.php index 44672edd3c..a4666c5a21 100644 --- a/src/applications/people/application/PhabricatorPeopleApplication.php +++ b/src/applications/people/application/PhabricatorPeopleApplication.php @@ -71,8 +71,8 @@ final class PhabricatorPeopleApplication extends PhabricatorApplication { ), '/p/(?P[\w._-]+)/' => array( '' => 'PhabricatorPeopleProfileViewController', - 'panel/' - => $this->getPanelRouting('PhabricatorPeopleProfilePanelController'), + 'item/' => $this->getProfileMenuRouting( + 'PhabricatorPeopleProfileMenuController'), ), ); } diff --git a/src/applications/people/controller/PhabricatorPeopleProfileEditController.php b/src/applications/people/controller/PhabricatorPeopleProfileEditController.php index 50fb0c29b5..3eda8a968b 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileEditController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileEditController.php @@ -85,7 +85,7 @@ final class PhabricatorPeopleProfileEditController $crumbs->setBorder(true); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::PANEL_MANAGE); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::ITEM_MANAGE); $header = id(new PHUIHeaderView()) ->setHeader(pht('Edit Profile: %s', $user->getFullName())) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileManageController.php b/src/applications/people/controller/PhabricatorPeopleProfileManageController.php index 6b087891be..c5a3ceabd4 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileManageController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileManageController.php @@ -43,7 +43,7 @@ final class PhabricatorPeopleProfileManageController $name = $user->getUsername(); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::PANEL_MANAGE); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::ITEM_MANAGE); $timeline = $this->buildTransactionTimeline( $user, diff --git a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php index 8a65a9b179..226646bc70 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php @@ -256,7 +256,7 @@ final class PhabricatorPeopleProfilePictureController $crumbs->setBorder(true); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::PANEL_MANAGE); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::ITEM_MANAGE); $header = id(new PHUIHeaderView()) ->setHeader(pht('Edit Profile Picture')) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php index a83a1f93ef..17fc67e2f3 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -78,7 +78,7 @@ final class PhabricatorPeopleProfileViewController )); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::PANEL_PROFILE); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::ITEM_PROFILE); $crumbs = $this->buildApplicationCrumbs(); $crumbs->setBorder(true); diff --git a/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php index 5d26d25cbb..aab3896721 100644 --- a/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php +++ b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php @@ -3,28 +3,28 @@ final class PhabricatorPeopleProfileMenuEngine extends PhabricatorProfileMenuEngine { - const PANEL_PROFILE = 'people.profile'; - const PANEL_MANAGE = 'people.manage'; + const ITEM_PROFILE = 'people.profile'; + const ITEM_MANAGE = 'people.manage'; protected function isMenuEngineConfigurable() { return false; } - protected function getPanelURI($path) { + protected function getItemURI($path) { $user = $this->getProfileObject(); $username = $user->getUsername(); $username = phutil_escape_uri($username); - return "/p/{$username}/panel/{$path}"; + return "/p/{$username}/item/{$path}"; } - protected function getBuiltinProfilePanels($object) { + protected function getBuiltinProfileItems($object) { $viewer = $this->getViewer(); - $panels = array(); + $items = array(); - $panels[] = $this->newPanel() - ->setBuiltinKey(self::PANEL_PROFILE) - ->setMenuItemKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY); + $items[] = $this->newItem() + ->setBuiltinKey(self::ITEM_PROFILE) + ->setMenuItemKey(PhabricatorPeopleDetailsProfileMenuItem::MENUITEMKEY); $have_maniphest = PhabricatorApplication::isClassInstalledForViewer( 'PhabricatorManiphestApplication', @@ -34,9 +34,9 @@ final class PhabricatorPeopleProfileMenuEngine '/maniphest/?statuses=open()&assigned=%s#R', $object->getPHID()); - $panels[] = $this->newPanel() + $items[] = $this->newItem() ->setBuiltinKey('tasks') - ->setMenuItemKey(PhabricatorLinkProfilePanel::PANELKEY) + ->setMenuItemKey(PhabricatorLinkProfileMenuItem::MENUITEMKEY) ->setMenuItemProperty('icon', 'maniphest') ->setMenuItemProperty('name', pht('Open Tasks')) ->setMenuItemProperty('uri', $uri); @@ -50,9 +50,9 @@ final class PhabricatorPeopleProfileMenuEngine '/differential/?authors=%s#R', $object->getPHID()); - $panels[] = $this->newPanel() + $items[] = $this->newItem() ->setBuiltinKey('revisions') - ->setMenuItemKey(PhabricatorLinkProfilePanel::PANELKEY) + ->setMenuItemKey(PhabricatorLinkProfileMenuItem::MENUITEMKEY) ->setMenuItemProperty('icon', 'differential') ->setMenuItemProperty('name', pht('Revisions')) ->setMenuItemProperty('uri', $uri); @@ -66,19 +66,19 @@ final class PhabricatorPeopleProfileMenuEngine '/audit/?authors=%s#R', $object->getPHID()); - $panels[] = $this->newPanel() + $items[] = $this->newItem() ->setBuiltinKey('commits') - ->setMenuItemKey(PhabricatorLinkProfilePanel::PANELKEY) + ->setMenuItemKey(PhabricatorLinkProfileMenuItem::MENUITEMKEY) ->setMenuItemProperty('icon', 'diffusion') ->setMenuItemProperty('name', pht('Commits')) ->setMenuItemProperty('uri', $uri); } - $panels[] = $this->newPanel() - ->setBuiltinKey(self::PANEL_MANAGE) - ->setMenuItemKey(PhabricatorPeopleManageProfilePanel::PANELKEY); + $items[] = $this->newItem() + ->setBuiltinKey(self::ITEM_MANAGE) + ->setMenuItemKey(PhabricatorPeopleManageProfileMenuItem::MENUITEMKEY); - return $panels; + return $items; } } diff --git a/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php b/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php similarity index 86% rename from src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php rename to src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php index 969d42f73c..0f5cb6c1fa 100644 --- a/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php +++ b/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php @@ -1,11 +1,11 @@ 'PhabricatorProjectEditPictureController', $this->getEditRoutePattern('edit/') => 'PhabricatorProjectEditController', - '(?P[1-9]\d*)/panel/' - => $this->getPanelRouting('PhabricatorProjectPanelController'), + '(?P[1-9]\d*)/item/' => $this->getProfileMenuRouting( + 'PhabricatorProjectMenuItemController'), 'subprojects/(?P[1-9]\d*)/' => 'PhabricatorProjectSubprojectsController', 'board/(?P[1-9]\d*)/'. diff --git a/src/applications/project/controller/PhabricatorProjectBoardController.php b/src/applications/project/controller/PhabricatorProjectBoardController.php index 04ab714eb0..d0c6abf882 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardController.php @@ -6,7 +6,7 @@ abstract class PhabricatorProjectBoardController protected function getProfileMenu() { $menu = parent::getProfileMenu(); - $menu->selectFilter(PhabricatorProject::PANEL_WORKBOARD); + $menu->selectFilter(PhabricatorProject::ITEM_WORKBOARD); $menu->addClass('project-board-nav'); return $menu; diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php index 8960781d89..fa2a423b09 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -170,7 +170,7 @@ final class PhabricatorProjectBoardViewController } $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorProject::PANEL_WORKBOARD); + $nav->selectFilter(PhabricatorProject::ITEM_WORKBOARD); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Workboard')); @@ -936,7 +936,7 @@ final class PhabricatorProjectBoardViewController if ($set_default) { $this ->getProfileMenuEngine() - ->adjustDefault(PhabricatorProject::PANEL_WORKBOARD); + ->adjustDefault(PhabricatorProject::ITEM_WORKBOARD); } if ($request->isFormPost()) { diff --git a/src/applications/project/controller/PhabricatorProjectEditPictureController.php b/src/applications/project/controller/PhabricatorProjectEditPictureController.php index 34a2c1b00e..4352ec6ad8 100644 --- a/src/applications/project/controller/PhabricatorProjectEditPictureController.php +++ b/src/applications/project/controller/PhabricatorProjectEditPictureController.php @@ -255,7 +255,7 @@ final class PhabricatorProjectEditPictureController ->setForm($upload_form); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorProject::PANEL_MANAGE); + $nav->selectFilter(PhabricatorProject::ITEM_MANAGE); return $this->newPage() ->setTitle($title) diff --git a/src/applications/project/controller/PhabricatorProjectManageController.php b/src/applications/project/controller/PhabricatorProjectManageController.php index c827f5abab..6ecdf6f62c 100644 --- a/src/applications/project/controller/PhabricatorProjectManageController.php +++ b/src/applications/project/controller/PhabricatorProjectManageController.php @@ -39,7 +39,7 @@ final class PhabricatorProjectManageController $timeline->setShouldTerminate(true); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorProject::PANEL_MANAGE); + $nav->selectFilter(PhabricatorProject::ITEM_MANAGE); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Manage')); @@ -91,7 +91,7 @@ final class PhabricatorProjectManageController id(new PhabricatorActionView()) ->setName(pht('Edit Menu')) ->setIcon('fa-th-list') - ->setHref($this->getApplicationURI("{$id}/panel/configure/")) + ->setHref($this->getApplicationURI("{$id}/item/configure/")) ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit)); diff --git a/src/applications/project/controller/PhabricatorProjectMembersViewController.php b/src/applications/project/controller/PhabricatorProjectMembersViewController.php index e98412ff31..959927c9f3 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersViewController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersViewController.php @@ -42,7 +42,7 @@ final class PhabricatorProjectMembersViewController ->setUserPHIDs($project->getWatcherPHIDs()); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorProject::PANEL_MEMBERS); + $nav->selectFilter(PhabricatorProject::ITEM_MEMBERS); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Members')); diff --git a/src/applications/project/controller/PhabricatorProjectPanelController.php b/src/applications/project/controller/PhabricatorProjectMenuItemController.php similarity index 90% rename from src/applications/project/controller/PhabricatorProjectPanelController.php rename to src/applications/project/controller/PhabricatorProjectMenuItemController.php index 940553368c..bd615c3f8e 100644 --- a/src/applications/project/controller/PhabricatorProjectPanelController.php +++ b/src/applications/project/controller/PhabricatorProjectMenuItemController.php @@ -1,6 +1,6 @@ setUserPHIDs($project->getWatcherPHIDs()); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorProject::PANEL_PROFILE); + $nav->selectFilter(PhabricatorProject::ITEM_PROFILE); $stories = id(new PhabricatorFeedQuery()) ->setViewer($viewer) diff --git a/src/applications/project/controller/PhabricatorProjectSubprojectsController.php b/src/applications/project/controller/PhabricatorProjectSubprojectsController.php index 1232d4010e..4a89bb4cde 100644 --- a/src/applications/project/controller/PhabricatorProjectSubprojectsController.php +++ b/src/applications/project/controller/PhabricatorProjectSubprojectsController.php @@ -92,7 +92,7 @@ final class PhabricatorProjectSubprojectsController ->addPropertyList($property_list); $nav = $this->getProfileMenu(); - $nav->selectFilter(PhabricatorProject::PANEL_SUBPROJECTS); + $nav->selectFilter(PhabricatorProject::ITEM_SUBPROJECTS); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Subprojects')); diff --git a/src/applications/project/controller/PhabricatorProjectViewController.php b/src/applications/project/controller/PhabricatorProjectViewController.php index 7a12d2c89c..d2f8d4f58d 100644 --- a/src/applications/project/controller/PhabricatorProjectViewController.php +++ b/src/applications/project/controller/PhabricatorProjectViewController.php @@ -18,13 +18,13 @@ final class PhabricatorProjectViewController $project = $this->getProject(); $engine = $this->getProfileMenuEngine(); - $default = $engine->getDefaultPanel(); + $default = $engine->getDefaultItem(); switch ($default->getBuiltinKey()) { - case PhabricatorProject::PANEL_WORKBOARD: + case PhabricatorProject::ITEM_WORKBOARD: $controller_object = new PhabricatorProjectBoardViewController(); break; - case PhabricatorProject::PANEL_PROFILE: + case PhabricatorProject::ITEM_PROFILE: default: $controller_object = new PhabricatorProjectProfileController(); break; diff --git a/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php b/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php index 5b6133b3a1..d3ea39e1e2 100644 --- a/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php +++ b/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php @@ -7,40 +7,41 @@ final class PhabricatorProjectProfileMenuEngine return true; } - protected function getPanelURI($path) { + protected function getItemURI($path) { $project = $this->getProfileObject(); $id = $project->getID(); - return "/project/{$id}/panel/{$path}"; + return "/project/{$id}/item/{$path}"; } - protected function getBuiltinProfilePanels($object) { - $panels = array(); + protected function getBuiltinProfileItems($object) { + $items = array(); - $panels[] = $this->newPanel() - ->setBuiltinKey(PhabricatorProject::PANEL_PROFILE) - ->setMenuItemKey(PhabricatorProjectDetailsProfilePanel::PANELKEY); + $items[] = $this->newItem() + ->setBuiltinKey(PhabricatorProject::ITEM_PROFILE) + ->setMenuItemKey(PhabricatorProjectDetailsProfileMenuItem::MENUITEMKEY); - $panels[] = $this->newPanel() - ->setBuiltinKey(PhabricatorProject::PANEL_POINTS) - ->setMenuItemKey(PhabricatorProjectPointsProfilePanel::PANELKEY); + $items[] = $this->newItem() + ->setBuiltinKey(PhabricatorProject::ITEM_POINTS) + ->setMenuItemKey(PhabricatorProjectPointsProfileMenuItem::MENUITEMKEY); - $panels[] = $this->newPanel() - ->setBuiltinKey(PhabricatorProject::PANEL_WORKBOARD) - ->setMenuItemKey(PhabricatorProjectWorkboardProfilePanel::PANELKEY); + $items[] = $this->newItem() + ->setBuiltinKey(PhabricatorProject::ITEM_WORKBOARD) + ->setMenuItemKey(PhabricatorProjectWorkboardProfileMenuItem::MENUITEMKEY); - $panels[] = $this->newPanel() - ->setBuiltinKey(PhabricatorProject::PANEL_MEMBERS) - ->setMenuItemKey(PhabricatorProjectMembersProfilePanel::PANELKEY); + $items[] = $this->newItem() + ->setBuiltinKey(PhabricatorProject::ITEM_MEMBERS) + ->setMenuItemKey(PhabricatorProjectMembersProfileMenuItem::MENUITEMKEY); - $panels[] = $this->newPanel() - ->setBuiltinKey(PhabricatorProject::PANEL_SUBPROJECTS) - ->setMenuItemKey(PhabricatorProjectSubprojectsProfilePanel::PANELKEY); + $items[] = $this->newItem() + ->setBuiltinKey(PhabricatorProject::ITEM_SUBPROJECTS) + ->setMenuItemKey( + PhabricatorProjectSubprojectsProfileMenuItem::MENUITEMKEY); - $panels[] = $this->newPanel() - ->setBuiltinKey(PhabricatorProject::PANEL_MANAGE) - ->setMenuItemKey(PhabricatorProjectManageProfilePanel::PANELKEY); + $items[] = $this->newItem() + ->setBuiltinKey(PhabricatorProject::ITEM_MANAGE) + ->setMenuItemKey(PhabricatorProjectManageProfileMenuItem::MENUITEMKEY); - return $panels; + return $items; } } diff --git a/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php b/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php similarity index 87% rename from src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php rename to src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php index 9e8c508bb7..becdd36c16 100644 --- a/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php +++ b/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php @@ -1,11 +1,11 @@ profileObject; } - public function setNewPanelConfiguration( + public function setNewMenuItemConfiguration( PhabricatorProfileMenuItemConfiguration $configuration) { - $this->newPanelConfiguration = $configuration; + $this->newMenuItemConfiguration = $configuration; return $this; } - public function getNewPanelConfiguration() { - return $this->newPanelConfiguration; + public function getNewMenuItemConfiguration() { + return $this->newMenuItemConfiguration; } public function setIsBuiltin($is_builtin) { @@ -52,11 +52,11 @@ final class PhabricatorProfileMenuEditEngine } public function getEngineName() { - return pht('Profile Panels'); + return pht('Profile Menu Items'); } public function getSummaryHeader() { - return pht('Edit Profile Panel Configurations'); + return pht('Edit Profile Menu Item Configurations'); } public function getSummaryText() { @@ -68,12 +68,14 @@ final class PhabricatorProfileMenuEditEngine } protected function newEditableObject() { - if (!$this->newPanelConfiguration) { + if (!$this->newMenuItemConfiguration) { throw new Exception( - pht('Profile panels can not be generated without an object context.')); + pht( + 'Profile menu items can not be generated without an '. + 'object context.')); } - return clone $this->newPanelConfiguration; + return clone $this->newMenuItemConfiguration; } protected function newObjectQuery() { @@ -121,8 +123,8 @@ final class PhabricatorProfileMenuEditEngine } protected function buildCustomEditFields($object) { - $panel = $object->getPanel(); - $fields = $panel->buildEditEngineFields($object); + $item = $object->getMenuItem(); + $fields = $item->buildEditEngineFields($object); $type_property = PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY; diff --git a/src/applications/search/editor/PhabricatorProfileMenuEditor.php b/src/applications/search/editor/PhabricatorProfileMenuEditor.php index 673e8728a9..d91bba272b 100644 --- a/src/applications/search/editor/PhabricatorProfileMenuEditor.php +++ b/src/applications/search/editor/PhabricatorProfileMenuEditor.php @@ -60,7 +60,7 @@ final class PhabricatorProfileMenuEditor case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY: $key = $xaction->getMetadataValue('property.key'); $value = $xaction->getNewValue(); - $object->getMenuItemProperty($key, $value); + $object->setMenuItemProperty($key, $value); return; case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER: $object->setMenuItemOrder($xaction->getNewValue()); diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php index 2f9f17ae32..6e16e15b9a 100644 --- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -4,8 +4,8 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { private $viewer; private $profileObject; - private $panels; - private $defaultPanel; + private $items; + private $defaultItem; private $controller; private $navigation; @@ -36,18 +36,18 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { return $this->controller; } - private function setDefaultPanel( - PhabricatorProfileMenuItemConfiguration $default_panel) { - $this->defaultPanel = $default_panel; + private function setDefaultItem( + PhabricatorProfileMenuItemConfiguration $default_item) { + $this->defaultItem = $default_item; return $this; } - public function getDefaultPanel() { - $this->loadPanels(); - return $this->defaultPanel; + public function getDefaultItem() { + $this->loadItems(); + return $this->defaultItem; } - abstract protected function getPanelURI($path); + abstract protected function getItemURI($path); abstract protected function isMenuEngineConfigurable(); @@ -59,12 +59,12 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $request = $controller->getRequest(); - $panel_action = $request->getURIData('panelAction'); + $item_action = $request->getURIData('itemAction'); // If the engine is not configurable, don't respond to any of the editing // or configuration routes. if (!$this->isMenuEngineConfigurable()) { - switch ($panel_action) { + switch ($item_action) { case 'view': break; default: @@ -72,80 +72,79 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } } - $panel_id = $request->getURIData('panelID'); + $item_id = $request->getURIData('itemID'); + $item_list = $this->loadItems(); - $panel_list = $this->loadPanels(); - - $selected_panel = null; - if (strlen($panel_id)) { - $panel_id_int = (int)$panel_id; - foreach ($panel_list as $panel) { - if ($panel_id_int) { - if ((int)$panel->getID() === $panel_id_int) { - $selected_panel = $panel; + $selected_item = null; + if (strlen($item_id)) { + $item_id_int = (int)$item_id; + foreach ($item_list as $item) { + if ($item_id_int) { + if ((int)$item->getID() === $item_id_int) { + $selected_item = $item; break; } } - $builtin_key = $panel->getBuiltinKey(); - if ($builtin_key === (string)$panel_id) { - $selected_panel = $panel; + $builtin_key = $item->getBuiltinKey(); + if ($builtin_key === (string)$item_id) { + $selected_item = $item; break; } } } - switch ($panel_action) { + switch ($item_action) { case 'view': case 'info': case 'hide': case 'default': case 'builtin': - if (!$selected_panel) { + if (!$selected_item) { return new Aphront404Response(); } break; } $navigation = $this->buildNavigation(); - $navigation->selectFilter('panel.configure'); + $navigation->selectFilter('item.configure'); $crumbs = $controller->buildApplicationCrumbsForEditEngine(); - switch ($panel_action) { + switch ($item_action) { case 'view': - $content = $this->buildPanelViewContent($selected_panel); + $content = $this->buildItemViewContent($selected_item); break; case 'configure': - $content = $this->buildPanelConfigureContent($panel_list); + $content = $this->buildItemConfigureContent($item_list); $crumbs->addTextCrumb(pht('Configure Menu')); break; case 'reorder': - $content = $this->buildPanelReorderContent($panel_list); + $content = $this->buildItemReorderContent($item_list); break; case 'new': - $panel_key = $request->getURIData('panelKey'); - $content = $this->buildPanelNewContent($panel_key); + $item_key = $request->getURIData('itemKey'); + $content = $this->buildItemNewContent($item_key); break; case 'builtin': - $content = $this->buildPanelBuiltinContent($selected_panel); + $content = $this->buildItemBuiltinContent($selected_item); break; case 'hide': - $content = $this->buildPanelHideContent($selected_panel); + $content = $this->buildItemHideContent($selected_item); break; case 'default': - $content = $this->buildPanelDefaultContent( - $selected_panel, - $panel_list); + $content = $this->buildItemDefaultContent( + $selected_item, + $item_list); break; case 'edit': - $content = $this->buildPanelEditContent(); + $content = $this->buildItemEditContent(); break; default: throw new Exception( pht( - 'Unsupported panel action "%s".', - $panel_action)); + 'Unsupported item action "%s".', + $item_action)); } if ($content instanceof AphrontResponse) { @@ -170,33 +169,33 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $nav = id(new AphrontSideNavFilterView()) ->setIsProfileMenu(true) - ->setBaseURI(new PhutilURI($this->getPanelURI(''))); + ->setBaseURI(new PhutilURI($this->getItemURI(''))); - $panels = $this->getPanels(); + $menu_items = $this->getItems(); - foreach ($panels as $panel) { - if ($panel->isDisabled()) { + foreach ($menu_items as $menu_item) { + if ($menu_item->isDisabled()) { continue; } - $items = $panel->buildNavigationMenuItems(); + $items = $menu_item->buildNavigationMenuItems(); foreach ($items as $item) { $this->validateNavigationMenuItem($item); } - // If the panel produced only a single item which does not otherwise + // If the item produced only a single item which does not otherwise // have a key, try to automatically assign it a reasonable key. This // makes selecting the correct item simpler. if (count($items) == 1) { $item = head($items); if ($item->getKey() === null) { - $builtin_key = $panel->getBuiltinKey(); - $panel_phid = $panel->getPHID(); + $builtin_key = $menu_item->getBuiltinKey(); + $item_phid = $menu_item->getPHID(); if ($builtin_key !== null) { $item->setKey($builtin_key); - } else if ($panel_phid !== null) { - $item->setKey($panel_phid); + } else if ($item_phid !== null) { + $item->setKey($item_phid); } } } @@ -217,75 +216,75 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { return $this->navigation; } - private function getPanels() { - if ($this->panels === null) { - $this->panels = $this->loadPanels(); + private function getItems() { + if ($this->items === null) { + $this->items = $this->loadItems(); } - return $this->panels; + return $this->items; } - private function loadPanels() { + private function loadItems() { $viewer = $this->getViewer(); $object = $this->getProfileObject(); - $panels = $this->loadBuiltinProfilePanels(); + $items = $this->loadBuiltinProfileItems(); - $stored_panels = id(new PhabricatorProfileMenuItemConfigurationQuery()) + $stored_items = id(new PhabricatorProfileMenuItemConfigurationQuery()) ->setViewer($viewer) ->withProfilePHIDs(array($object->getPHID())) ->execute(); - foreach ($stored_panels as $stored_panel) { - $impl = $stored_panel->getPanel(); + foreach ($stored_items as $stored_item) { + $impl = $stored_item->getMenuItem(); $impl->setViewer($viewer); } - // Merge the stored panels into the builtin panels. If a builtin panel has + // Merge the stored items into the builtin items. If a builtin item has // a stored version, replace the defaults with the stored changes. - foreach ($stored_panels as $stored_panel) { - if (!$stored_panel->shouldEnableForObject($object)) { + foreach ($stored_items as $stored_item) { + if (!$stored_item->shouldEnableForObject($object)) { continue; } - $builtin_key = $stored_panel->getBuiltinKey(); + $builtin_key = $stored_item->getBuiltinKey(); if ($builtin_key !== null) { // If this builtin actually exists, replace the builtin with the // stored configuration. Otherwise, we're just going to drop the // stored config: it corresponds to an out-of-date or uninstalled - // panel. - if (isset($panels[$builtin_key])) { - $panels[$builtin_key] = $stored_panel; + // item. + if (isset($items[$builtin_key])) { + $items[$builtin_key] = $stored_item; } else { continue; } } else { - $panels[] = $stored_panel; + $items[] = $stored_item; } } - $panels = msort($panels, 'getSortKey'); + $items = msort($items, 'getSortKey'); // Normalize keys since callers shouldn't rely on this array being // partially keyed. - $panels = array_values($panels); + $items = array_values($items); - // Make sure exactly one valid panel is marked as default. + // Make sure exactly one valid item is marked as default. $default = null; $first = null; - foreach ($panels as $panel) { - if (!$panel->canMakeDefault()) { + foreach ($items as $item) { + if (!$item->canMakeDefault()) { continue; } - if ($panel->isDefault()) { - $default = $panel; + if ($item->isDefault()) { + $default = $item; break; } if ($first === null) { - $first = $panel; + $first = $item; } } @@ -294,17 +293,17 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } if ($default) { - $this->setDefaultPanel($default); + $this->setDefaultItem($default); } - return $panels; + return $items; } - private function loadBuiltinProfilePanels() { + private function loadBuiltinProfileItems() { $object = $this->getProfileObject(); - $builtins = $this->getBuiltinProfilePanels($object); + $builtins = $this->getBuiltinProfileItems($object); - $panels = PhabricatorProfilePanel::getAllPanels(); + $items = PhabricatorProfileMenuItem::getAllMenuItems(); $viewer = $this->getViewer(); $order = 1; @@ -315,36 +314,36 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { if (!$builtin_key) { throw new Exception( pht( - 'Object produced a builtin panel with no builtin panel key! '. - 'Builtin panels must have a unique key.')); + 'Object produced a builtin item with no builtin item key! '. + 'Builtin items must have a unique key.')); } if (isset($map[$builtin_key])) { throw new Exception( pht( - 'Object produced two panels with the same builtin key ("%s"). '. - 'Each panel must have a unique builtin key.', + 'Object produced two items with the same builtin key ("%s"). '. + 'Each item must have a unique builtin key.', $builtin_key)); } - $panel_key = $builtin->getMenuItemKey(); + $item_key = $builtin->getMenuItemKey(); - $panel = idx($panels, $panel_key); - if (!$panel) { + $item = idx($items, $item_key); + if (!$item) { throw new Exception( pht( - 'Builtin panel ("%s") specifies a bad panel key ("%s"); there '. - 'is no corresponding panel implementation available.', + 'Builtin item ("%s") specifies a bad item key ("%s"); there '. + 'is no corresponding item implementation available.', $builtin_key, - $panel_key)); + $item_key)); } - $panel = clone $panel; - $panel->setViewer($viewer); + $item = clone $item; + $item->setViewer($viewer); $builtin ->setProfilePHID($object->getPHID()) - ->attachPanel($panel) + ->attachMenuItem($item) ->attachProfileObject($object) ->setMenuItemOrder($order); @@ -437,10 +436,10 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } public function getConfigureURI() { - return $this->getPanelURI('configure/'); + return $this->getItemURI('configure/'); } - private function buildPanelReorderContent(array $panels) { + private function buildItemReorderContent(array $items) { $viewer = $this->getViewer(); $object = $this->getProfileObject(); @@ -459,14 +458,14 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $by_builtin = array(); $by_id = array(); - foreach ($panels as $key => $panel) { - $id = $panel->getID(); + foreach ($items as $key => $item) { + $id = $item->getID(); if ($id) { $by_id[$id] = $key; continue; } - $builtin_key = $panel->getBuiltinKey(); + $builtin_key = $item->getBuiltinKey(); if ($builtin_key) { $by_builtin[$builtin_key] = $key; continue; @@ -485,13 +484,13 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } } - $panels = array_select_keys($panels, $key_order) + $panels; + $items = array_select_keys($items, $key_order) + $items; $type_order = PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER; $order = 1; - foreach ($panels as $panel) { + foreach ($items as $item) { $xactions = array(); $xactions[] = id(new PhabricatorProfileMenuItemConfigurationTransaction()) @@ -503,7 +502,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->setActor($viewer) ->setContinueOnMissingFields(true) ->setContinueOnNoEffect(true) - ->applyTransactions($panel, $xactions); + ->applyTransactions($item, $xactions); $order++; } @@ -513,7 +512,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } - private function buildPanelConfigureContent(array $panels) { + private function buildItemConfigureContent(array $items) { $viewer = $this->getViewer(); $object = $this->getProfileObject(); @@ -528,34 +527,34 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { 'reorder-profile-menu-items', array( 'listID' => $list_id, - 'orderURI' => $this->getPanelURI('reorder/'), + 'orderURI' => $this->getItemURI('reorder/'), )); $list = id(new PHUIObjectItemListView()) ->setID($list_id); - foreach ($panels as $panel) { - $id = $panel->getID(); - $builtin_key = $panel->getBuiltinKey(); + foreach ($items as $item) { + $id = $item->getID(); + $builtin_key = $item->getBuiltinKey(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, - $panel, + $item, PhabricatorPolicyCapability::CAN_EDIT); - $item = id(new PHUIObjectItemView()); + $view = id(new PHUIObjectItemView()); - $name = $panel->getDisplayName(); - $type = $panel->getPanelTypeName(); + $name = $item->getDisplayName(); + $type = $item->getMenuItemTypeName(); if (!strlen(trim($name))) { $name = pht('Untitled "%s" Item', $type); } - $item->setHeader($name); - $item->addAttribute($type); + $view->setHeader($name); + $view->addAttribute($type); if ($can_edit) { - $item + $view ->setGrippable(true) ->addSigil('profile-menu-item') ->setMetadata( @@ -564,15 +563,15 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { )); if ($id) { - $default_uri = $this->getPanelURI("default/{$id}/"); + $default_uri = $this->getItemURI("default/{$id}/"); } else { - $default_uri = $this->getPanelURI("default/{$builtin_key}/"); + $default_uri = $this->getItemURI("default/{$builtin_key}/"); } - if ($panel->isDefault()) { + if ($item->isDefault()) { $default_icon = 'fa-thumb-tack green'; $default_text = pht('Current Default'); - } else if ($panel->canMakeDefault()) { + } else if ($item->canMakeDefault()) { $default_icon = 'fa-thumb-tack'; $default_text = pht('Make Default'); } else { @@ -580,7 +579,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } if ($default_text !== null) { - $item->addAction( + $view->addAction( id(new PHUIListItemView()) ->setHref($default_uri) ->setWorkflow(true) @@ -589,17 +588,17 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } if ($id) { - $item->setHref($this->getPanelURI("edit/{$id}/")); - $hide_uri = $this->getPanelURI("hide/{$id}/"); + $view->setHref($this->getItemURI("edit/{$id}/")); + $hide_uri = $this->getItemURI("hide/{$id}/"); } else { - $item->setHref($this->getPanelURI("builtin/{$builtin_key}/")); - $hide_uri = $this->getPanelURI("hide/{$builtin_key}/"); + $view->setHref($this->getItemURI("builtin/{$builtin_key}/")); + $hide_uri = $this->getItemURI("hide/{$builtin_key}/"); } - if ($panel->isDisabled()) { + if ($item->isDisabled()) { $hide_icon = 'fa-plus'; $hide_text = pht('Enable'); - } else if ($panel->getBuiltinKey() !== null) { + } else if ($item->getBuiltinKey() !== null) { $hide_icon = 'fa-times'; $hide_text = pht('Disable'); } else { @@ -607,9 +606,9 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $hide_text = pht('Delete'); } - $can_disable = $panel->canHideMenuItem(); + $can_disable = $item->canHideMenuItem(); - $item->addAction( + $view->addAction( id(new PHUIListItemView()) ->setHref($hide_uri) ->setWorkflow(true) @@ -618,35 +617,35 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->setIcon($hide_icon)); } - if ($panel->isDisabled()) { - $item->setDisabled(true); + if ($item->isDisabled()) { + $view->setDisabled(true); } - $list->addItem($item); + $list->addItem($view); } $action_view = id(new PhabricatorActionListView()) ->setUser($viewer); - $panel_types = PhabricatorProfilePanel::getAllPanels(); + $item_types = PhabricatorProfileMenuItem::getAllMenuItems(); $action_view->addAction( id(new PhabricatorActionView()) ->setLabel(true) ->setName(pht('Add New Menu Item...'))); - foreach ($panel_types as $panel_type) { - if (!$panel_type->canAddToObject($object)) { + foreach ($item_types as $item_type) { + if (!$item_type->canAddToObject($object)) { continue; } - $panel_key = $panel_type->getPanelKey(); + $item_key = $item_type->getMenuItemKey(); $action_view->addAction( id(new PhabricatorActionView()) - ->setIcon($panel_type->getPanelTypeIcon()) - ->setName($panel_type->getPanelTypeName()) - ->setHref($this->getPanelURI("new/{$panel_key}/"))); + ->setIcon($item_type->getMenuItemTypeIcon()) + ->setName($item_type->getMenuItemTypeName()) + ->setHref($this->getItemURI("new/{$item_key}/"))); } $action_view->addAction( @@ -682,22 +681,21 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { return $box; } - private function buildPanelNewContent($panel_key) { - $panel_types = PhabricatorProfilePanel::getAllPanels(); - $panel_type = idx($panel_types, $panel_key); - if (!$panel_type) { + private function buildItemNewContent($item_key) { + $item_types = PhabricatorProfileMenuItem::getAllMenuItems(); + $item_type = idx($item_types, $item_key); + if (!$item_type) { return new Aphront404Response(); } $object = $this->getProfileObject(); - if (!$panel_type->canAddToObject($object)) { + if (!$item_type->canAddToObject($object)) { return new Aphront404Response(); } - $configuration = - PhabricatorProfileMenuItemConfiguration::initializeNewPanelConfiguration( - $object, - $panel_type); + $configuration = PhabricatorProfileMenuItemConfiguration::initializeNewItem( + $object, + $item_type); $viewer = $this->getViewer(); @@ -711,12 +709,12 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { return id(new PhabricatorProfileMenuEditEngine()) ->setMenuEngine($this) ->setProfileObject($object) - ->setNewPanelConfiguration($configuration) + ->setNewMenuItemConfiguration($configuration) ->setController($controller) ->buildResponse(); } - private function buildPanelEditContent() { + private function buildItemEditContent() { $viewer = $this->getViewer(); $object = $this->getProfileObject(); $controller = $this->getController(); @@ -728,18 +726,18 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->buildResponse(); } - private function buildPanelBuiltinContent( + private function buildItemBuiltinContent( PhabricatorProfileMenuItemConfiguration $configuration) { - // If this builtin panel has already been persisted, redirect to the + // If this builtin item has already been persisted, redirect to the // edit page. $id = $configuration->getID(); if ($id) { return id(new AphrontRedirectResponse()) - ->setURI($this->getPanelURI("edit/{$id}/")); + ->setURI($this->getItemURI("edit/{$id}/")); } - // Otherwise, act like we're creating a new panel, we're just starting + // Otherwise, act like we're creating a new item, we're just starting // with the builtin template. $viewer = $this->getViewer(); @@ -755,12 +753,12 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->setIsBuiltin(true) ->setMenuEngine($this) ->setProfileObject($object) - ->setNewPanelConfiguration($configuration) + ->setNewMenuItemConfiguration($configuration) ->setController($controller) ->buildResponse(); } - private function buildPanelHideContent( + private function buildItemHideContent( PhabricatorProfileMenuItemConfiguration $configuration) { $controller = $this->getController(); @@ -774,9 +772,9 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { if (!$configuration->canHideMenuItem()) { return $controller->newDialog() - ->setTitle(pht('Mandatory Panel')) + ->setTitle(pht('Mandatory Item')) ->appendParagraph( - pht('This panel is very important, and can not be disabled.')) + pht('This menu item is very important, and can not be disabled.')) ->addCancelButton($this->getConfigureURI()); } @@ -837,9 +835,9 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->addSubmitButton($button); } - private function buildPanelDefaultContent( + private function buildItemDefaultContent( PhabricatorProfileMenuItemConfiguration $configuration, - array $panels) { + array $items) { $controller = $this->getController(); $request = $controller->getRequest(); @@ -894,7 +892,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->addSubmitButton(pht('Make Default')); } - protected function newPanel() { + protected function newItem() { return PhabricatorProfileMenuItemConfiguration::initializeNewBuiltin(); } @@ -903,30 +901,30 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $request = $controller->getRequest(); $viewer = $request->getViewer(); - $panels = $this->loadPanels(); + $items = $this->loadItems(); - // To adjust the default panel, we first change any existing panels that - // are marked as defaults to "visible", then make the new default panel + // To adjust the default item, we first change any existing items that + // are marked as defaults to "visible", then make the new default item // the default. $default = array(); $visible = array(); - foreach ($panels as $panel) { - $builtin_key = $panel->getBuiltinKey(); - $id = $panel->getID(); + foreach ($items as $item) { + $builtin_key = $item->getBuiltinKey(); + $id = $item->getID(); $is_target = (($builtin_key !== null) && ($builtin_key === $key)) || (($id !== null) && ((int)$id === (int)$key)); if ($is_target) { - if (!$panel->isDefault()) { - $default[] = $panel; + if (!$item->isDefault()) { + $default[] = $item; } } else { - if ($panel->isDefault()) { - $visible[] = $panel; + if ($item->isDefault()) { + $visible[] = $item; } } } @@ -943,8 +941,8 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ); foreach ($apply as $group) { - list($value, $panels) = $group; - foreach ($panels as $panel) { + list($value, $items) = $group; + foreach ($items as $item) { $xactions = array(); $xactions[] = @@ -957,7 +955,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->setActor($viewer) ->setContinueOnMissingFields(true) ->setContinueOnNoEffect(true) - ->applyTransactions($panel, $xactions); + ->applyTransactions($item, $xactions); } } diff --git a/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php similarity index 89% rename from src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php rename to src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php index 1486f5309e..214819100e 100644 --- a/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php +++ b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php @@ -1,15 +1,15 @@ setKey('icon') ->setLabel(pht('Icon')) - ->setIconSet(new PhabricatorProfilePanelIconSet()) + ->setIconSet(new PhabricatorProfileMenuItemIconSet()) ->setValue($this->getLinkIcon($config)), ); } @@ -73,7 +73,7 @@ final class PhabricatorLinkProfilePanel $href = '#'; } - $icon_object = id(new PhabricatorProfilePanelIconSet()) + $icon_object = id(new PhabricatorProfileMenuItemIconSet()) ->getIcon($icon); if ($icon_object) { $icon_class = $icon_object->getIcon(); diff --git a/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php b/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php similarity index 94% rename from src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php rename to src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php index cbdeb4fe0e..f53bc2b0eb 100644 --- a/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php +++ b/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php @@ -1,15 +1,15 @@ setValue( pht( 'Motivate your team with inspirational quotes from great minds. '. - 'This panel shows a new quote every day.')), + 'This menu item shows a new quote every day.')), id(new PhabricatorSelectEditField()) ->setKey('source') ->setLabel(pht('Source')) diff --git a/src/applications/search/profilepanel/PhabricatorProfilePanel.php b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php similarity index 76% rename from src/applications/search/profilepanel/PhabricatorProfilePanel.php rename to src/applications/search/menuitem/PhabricatorProfileMenuItem.php index 48b42808f8..f37cab236c 100644 --- a/src/applications/search/profilepanel/PhabricatorProfilePanel.php +++ b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php @@ -1,6 +1,6 @@ viewer; } - final public function getPanelKey() { - return $this->getPhobjectClassConstant('PANELKEY'); + final public function getMenuItemKey() { + return $this->getPhobjectClassConstant('MENUITEMKEY'); } - final public static function getAllPanels() { + final public static function getAllMenuItems() { return id(new PhutilClassMapQuery()) ->setAncestorClass(__CLASS__) - ->setUniqueMethod('getPanelKey') + ->setUniqueMethod('getMenuItemKey') ->execute(); } diff --git a/src/applications/search/profilepanel/PhabricatorProfilePanelIconSet.php b/src/applications/search/menuitem/PhabricatorProfileMenuItemIconSet.php similarity index 94% rename from src/applications/search/profilepanel/PhabricatorProfilePanelIconSet.php rename to src/applications/search/menuitem/PhabricatorProfileMenuItemIconSet.php index bc3b15a7cf..74333cc087 100644 --- a/src/applications/search/profilepanel/PhabricatorProfilePanelIconSet.php +++ b/src/applications/search/menuitem/PhabricatorProfileMenuItemIconSet.php @@ -1,9 +1,9 @@ $panel) { - $panel_type = idx($panels, $panel->getMenuItemKey()); - if (!$panel_type) { - $this->didRejectResult($panel); + $items = PhabricatorProfileMenuItem::getAllMenuItems(); + foreach ($page as $key => $item) { + $item_type = idx($items, $item->getMenuItemKey()); + if (!$item_type) { + $this->didRejectResult($item); unset($page[$key]); continue; } - $panel->attachPanel($panel_type); + $item->attachMenuItem($item_type); } if (!$page) { @@ -82,14 +82,14 @@ final class PhabricatorProfileMenuItemConfigurationQuery ->execute(); $profiles = mpull($profiles, null, 'getPHID'); - foreach ($page as $key => $panel) { - $profile = idx($profiles, $panel->getProfilePHID()); + foreach ($page as $key => $item) { + $profile = idx($profiles, $item->getProfilePHID()); if (!$profile) { - $this->didRejectResult($panel); + $this->didRejectResult($item); unset($page[$key]); continue; } - $panel->attachProfileObject($profile); + $item->attachProfileObject($profile); } return $page; diff --git a/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php b/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php index 95dc09e945..46aa03e25d 100644 --- a/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php +++ b/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php @@ -15,7 +15,7 @@ final class PhabricatorProfileMenuItemConfiguration protected $menuItemProperties = array(); private $profileObject = self::ATTACHABLE; - private $panel = self::ATTACHABLE; + private $menuItem = self::ATTACHABLE; const VISIBILITY_DEFAULT = 'default'; const VISIBILITY_VISIBLE = 'visible'; @@ -31,14 +31,14 @@ final class PhabricatorProfileMenuItemConfiguration ->setVisibility(self::VISIBILITY_VISIBLE); } - public static function initializeNewPanelConfiguration( + public static function initializeNewItem( $profile_object, - PhabricatorProfilePanel $panel) { + PhabricatorProfileMenuItem $item) { return self::initializeNewBuiltin() ->setProfilePHID($profile_object->getPHID()) - ->setMenuItemKey($panel->getPanelKey()) - ->attachPanel($panel) + ->setMenuItemKey($item->getMenuItemKey()) + ->attachMenuItem($item) ->attachProfileObject($profile_object); } @@ -67,13 +67,13 @@ final class PhabricatorProfileMenuItemConfiguration PhabricatorProfileMenuItemPHIDType::TYPECONST); } - public function attachPanel(PhabricatorProfilePanel $panel) { - $this->panel = $panel; + public function attachMenuItem(PhabricatorProfileMenuItem $item) { + $this->menuItem = $item; return $this; } - public function getPanel() { - return $this->assertAttached($this->panel); + public function getMenuItem() { + return $this->assertAttached($this->menuItem); } public function attachProfileObject($profile_object) { @@ -95,27 +95,27 @@ final class PhabricatorProfileMenuItemConfiguration } public function buildNavigationMenuItems() { - return $this->getPanel()->buildNavigationMenuItems($this); + return $this->getMenuItem()->buildNavigationMenuItems($this); } - public function getPanelTypeName() { - return $this->getPanel()->getPanelTypeName(); + public function getMenuItemTypeName() { + return $this->getMenuItem()->getMenuItemTypeName(); } public function getDisplayName() { - return $this->getPanel()->getDisplayName($this); + return $this->getMenuItem()->getDisplayName($this); } public function canMakeDefault() { - return $this->getPanel()->canMakeDefault($this); + return $this->getMenuItem()->canMakeDefault($this); } public function canHideMenuItem() { - return $this->getPanel()->canHidePanel($this); + return $this->getMenuItem()->canHideMenuItem($this); } public function shouldEnableForObject($object) { - return $this->getPanel()->shouldEnableForObject($object); + return $this->getMenuItem()->shouldEnableForObject($object); } public function getSortKey() { diff --git a/src/docs/user/userguide/profile_menu.diviner b/src/docs/user/userguide/profile_menu.diviner index bd278b2702..2b4ffc4be8 100644 --- a/src/docs/user/userguide/profile_menu.diviner +++ b/src/docs/user/userguide/profile_menu.diviner @@ -146,4 +146,4 @@ Writing New Item Types IMPORTANT: This feature is not stable, and the API is subject to change. -To add new types of items, subclass @{class:PhabricatorProfilePanel}. +To add new types of items, subclass @{class:PhabricatorProfileMenuItem}. From 237f94b830a45a7a03d3c2bef8103cdc2ca1578d Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 11 Dec 2016 12:22:19 -0800 Subject: [PATCH 07/78] Fix flaky subscribers policy rule unit test Summary: I'm about 90% sure this fixes the intermittent test failure on `testObjectSubscribersPolicyRule()` or whatever. We use `spl_object_hash()` to identify objects when passing hints about policy changes to policy rules. This is hacky, and I think it's the source of the unit test issue. Specifically, `spl_object_hash()` is approximately just returning the memory address of the object, and two objects can occasionally use the same memory address (one gets garbage collected; another uses the same memory). If I replace `spl_object_hash()` with a static value like "zebra", the test failure reproduces. Instead, sneak an object ID onto a runtime property. This is at least as hacky but shouldn't suffer from the same intermittent failure. Test Plan: Ran `arc unit --everything`, but I never got a reliable repro of the issue in the first place, so who knows. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D17029 --- .../policy/rule/PhabricatorPolicyRule.php | 27 ++++++++++++++++--- src/infrastructure/storage/lisk/LiskDAO.php | 11 +++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/applications/policy/rule/PhabricatorPolicyRule.php b/src/applications/policy/rule/PhabricatorPolicyRule.php index bd5af9a1b8..2f9fac9cfb 100644 --- a/src/applications/policy/rule/PhabricatorPolicyRule.php +++ b/src/applications/policy/rule/PhabricatorPolicyRule.php @@ -144,9 +144,30 @@ abstract class PhabricatorPolicyRule extends Phobject { private static function getObjectPolicyCacheKey( PhabricatorPolicyInterface $object, PhabricatorPolicyRule $rule) { - $hash = spl_object_hash($object); - $rule = get_class($rule); - return 'policycache.'.$hash.'.'.$rule; + + // NOTE: This is quite a bit of a hack, but we don't currently have a + // better way to carry hints from the TransactionEditor into PolicyRules + // about pending policy changes. + + // Put some magic secret unique value on each object so we can pass + // information about it by proxy. This allows us to test if pending + // edits to an object will cause policy violations or not, before allowing + // those edits to go through. + + // Some better approaches might be: + // - Use traits to give `PhabricatorPolicyInterface` objects real + // storage (requires PHP 5.4.0). + // - Wrap policy objects in a container with extra storage which the + // policy filter knows how to unbox (lots of work). + + // When this eventually gets cleaned up, the corresponding hack in + // LiskDAO->__set() should also be cleaned up. + static $id = 0; + if (!isset($object->_hashKey)) { + @$object->_hashKey = 'object.id('.(++$id).')'; + } + + return $object->_hashKey; } diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php index 71cfba3d54..0527c3cf1e 100644 --- a/src/infrastructure/storage/lisk/LiskDAO.php +++ b/src/infrastructure/storage/lisk/LiskDAO.php @@ -1780,10 +1780,13 @@ abstract class LiskDAO extends Phobject { * @task util */ public function __set($name, $value) { - phlog( - pht( - 'Wrote to undeclared property %s.', - get_class($this).'::$'.$name)); + // Hack for policy system hints, see PhabricatorPolicyRule for notes. + if ($name != '_hashKey') { + phlog( + pht( + 'Wrote to undeclared property %s.', + get_class($this).'::$'.$name)); + } $this->$name = $value; } From d8b028b51bc038f00e3ff33122aa3a5960c46917 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 12 Dec 2016 08:35:22 -0800 Subject: [PATCH 08/78] Clean up Profile Menu Item page Summary: Cleans up the UI on the page here, uses two column layout, places actions as actionlist instead of dropdown. Changes edit pages to dialogs. Test Plan: Add an application, divider, link, and facts to a menu page. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17030 --- .../engine/PhabricatorProfileMenuEngine.php | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php index 6e16e15b9a..7126a12ddd 100644 --- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -155,8 +155,10 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { return $content; } + $crumbs->setBorder(true); + return $controller->newPage() - ->setTitle(pht('Profile Stuff')) + ->setTitle(pht('Configure Menu')) ->setNavigation($navigation) ->setCrumbs($crumbs) ->appendChild($content); @@ -628,8 +630,12 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->setUser($viewer); $item_types = PhabricatorProfileMenuItem::getAllMenuItems(); + $object = $this->getProfileObject(); - $action_view->addAction( + $action_list = id(new PhabricatorActionListView()) + ->setViewer($viewer); + + $action_list->addAction( id(new PhabricatorActionView()) ->setLabel(true) ->setName(pht('Add New Menu Item...'))); @@ -641,14 +647,15 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $item_key = $item_type->getMenuItemKey(); - $action_view->addAction( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon($item_type->getMenuItemTypeIcon()) ->setName($item_type->getMenuItemTypeName()) - ->setHref($this->getItemURI("new/{$item_key}/"))); + ->setHref($this->getItemURI("new/{$item_key}/")) + ->setWorkflow(true)); } - $action_view->addAction( + $action_list->addAction( id(new PhabricatorActionView()) ->setLabel(true) ->setName(pht('Documentation'))); @@ -656,29 +663,37 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { $doc_link = PhabricatorEnv::getDoclink('Profile Menu User Guide'); $doc_name = pht('Profile Menu User Guide'); - $action_view->addAction( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-book') ->setHref($doc_link) ->setName($doc_name)); - $action_button = id(new PHUIButtonView()) - ->setTag('a') - ->setText(pht('Configure Menu')) - ->setHref('#') - ->setIcon('fa-gear') - ->setDropdownMenu($action_view); - $header = id(new PHUIHeaderView()) ->setHeader(pht('Profile Menu Items')) - ->setSubHeader(pht('Drag tabs to reorder menu')) - ->addActionLink($action_button); + ->setHeaderIcon('fa-list'); $box = id(new PHUIObjectBoxView()) - ->setHeader($header) + ->setHeaderText(pht('Navigation')) + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->setObjectList($list); - return $box; + $panel = id(new PHUICurtainPanelView()) + ->appendChild($action_view); + + $curtain = id(new PHUICurtainView()) + ->setViewer($viewer) + ->setActionList($action_list); + + $view = id(new PHUITwoColumnView()) + ->setHeader($header) + ->setCurtain($curtain) + ->setMainColumn( + array( + $box, + )); + + return $view; } private function buildItemNewContent($item_key) { From a79e4b786ea364d3d210540be0852ea3221475cc Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 12 Dec 2016 09:04:03 -0800 Subject: [PATCH 09/78] Restrict hover styles in action list to only href Summary: We're currently applying these styles to labels, restrict them to only list elements that have an href. Test Plan: Test a label, an anchor, and a button as an action item. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17031 --- resources/celerity/map.php | 6 +++--- src/view/layout/PhabricatorActionView.php | 4 ++++ webroot/rsrc/css/phui/phui-two-column-view.css | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 432d76abd3..686bb008cb 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '0b64e988', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => '1ef46ae8', + 'core.pkg.css' => 'e18bf0da', 'core.pkg.js' => 'e4260032', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'a4ba74b5', @@ -165,7 +165,7 @@ return array( 'rsrc/css/phui/phui-status.css' => 'd5263e49', 'rsrc/css/phui/phui-tag-view.css' => '6bbd83e2', 'rsrc/css/phui/phui-timeline-view.css' => 'bc523970', - 'rsrc/css/phui/phui-two-column-view.css' => 'ee61d056', + 'rsrc/css/phui/phui-two-column-view.css' => 'f662d744', 'rsrc/css/phui/workboards/phui-workboard-color.css' => 'b60ef38a', 'rsrc/css/phui/workboards/phui-workboard.css' => '16441d5e', 'rsrc/css/phui/workboards/phui-workcard.css' => '0c62d7c5', @@ -882,7 +882,7 @@ return array( 'phui-tag-view-css' => '6bbd83e2', 'phui-theme-css' => '798c69b8', 'phui-timeline-view-css' => 'bc523970', - 'phui-two-column-view-css' => 'ee61d056', + 'phui-two-column-view-css' => 'f662d744', 'phui-workboard-color-css' => 'b60ef38a', 'phui-workboard-view-css' => '16441d5e', 'phui-workcard-view-css' => '0c62d7c5', diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php index 493f8c3dbd..8788529945 100644 --- a/src/view/layout/PhabricatorActionView.php +++ b/src/view/layout/PhabricatorActionView.php @@ -271,6 +271,10 @@ final class PhabricatorActionView extends AphrontView { $classes[] = 'phabricator-action-view-submenu'; } + if ($this->getHref()) { + $classes[] = 'phabricator-action-view-href'; + } + $style = array(); if ($this->hidden) { diff --git a/webroot/rsrc/css/phui/phui-two-column-view.css b/webroot/rsrc/css/phui/phui-two-column-view.css index aea567d025..a486231a63 100644 --- a/webroot/rsrc/css/phui/phui-two-column-view.css +++ b/webroot/rsrc/css/phui/phui-two-column-view.css @@ -164,7 +164,7 @@ padding: 5px 4px 5px 28px; } -.device-desktop .phui-two-column-properties .phabricator-action-view:hover +.device-desktop .phui-two-column-properties .phabricator-action-view-href:hover .phabricator-action-view-item { text-decoration: none; background-color: rgba({$alphablue}, .08); @@ -172,7 +172,7 @@ border-radius: 3px; } -.device-desktop .phui-two-column-properties .phabricator-action-view:hover +.device-desktop .phui-two-column-properties .phabricator-action-view-href:hover .phabricator-action-view-icon { color: {$sky}; } From 8e0d936f72c79f065aac2aca7d1e89e93b116837 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 12 Dec 2016 10:15:37 -0800 Subject: [PATCH 10/78] Fix two overzealous renames of getPanelKey() Summary: Fixes T11999. These are actual panels (SettingsPanel) which are panelley so it's OK. Test Plan: Clicked "Customize Menu..." on Home. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11999 Differential Revision: https://secure.phabricator.com/D17032 --- .../settings/controller/PhabricatorSettingsMainController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/settings/controller/PhabricatorSettingsMainController.php b/src/applications/settings/controller/PhabricatorSettingsMainController.php index 4142e61969..fada4a0937 100644 --- a/src/applications/settings/controller/PhabricatorSettingsMainController.php +++ b/src/applications/settings/controller/PhabricatorSettingsMainController.php @@ -98,7 +98,7 @@ final class PhabricatorSettingsMainController $panels = $this->buildPanels($preferences); $nav = $this->renderSideNav($panels); - $key = $nav->selectFilter($key, head($panels)->getMenuItemKey()); + $key = $nav->selectFilter($key, head($panels)->getPanelKey()); $panel = $panels[$key] ->setController($this) @@ -196,7 +196,7 @@ final class PhabricatorSettingsMainController $nav->addLabel($group->getPanelGroupName()); } - $nav->addFilter($panel->getMenuItemKey(), $panel->getPanelName()); + $nav->addFilter($panel->getPanelKey(), $panel->getPanelName()); } return $nav; From 3277e78732116e661bc1b784e29aecd5ede294ec Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 12 Dec 2016 10:33:23 -0800 Subject: [PATCH 11/78] Move timeline anchor targets up to evade a Chrome 55 behavioral change Summary: Fixes T11997. This lifts the targets out of the containing `overflow: hidden;` div so Chrome is willing to target them. Test Plan: In Chrome, visited direct comment links and ended up in the right place. Clicked comment anchors, saw browser jump around again. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11997 Differential Revision: https://secure.phabricator.com/D17033 --- src/view/phui/PHUITimelineEventView.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/view/phui/PHUITimelineEventView.php b/src/view/phui/PHUITimelineEventView.php index 87fee5cfa6..a5834befd3 100644 --- a/src/view/phui/PHUITimelineEventView.php +++ b/src/view/phui/PHUITimelineEventView.php @@ -347,6 +347,17 @@ final class PHUITimelineEventView extends AphrontView { $group_children = array(); foreach ($events as $event) { if ($event->shouldRenderEventTitle()) { + + // Render the group anchor here, outside the title box. If we render + // it inside the title box it ends up completely hidden and Chrome 55 + // refuses to jump to it. See T11997 for discussion. + + if ($extra && $this->anchor) { + $group_titles[] = id(new PhabricatorAnchorView()) + ->setAnchorName($this->anchor) + ->render(); + } + $group_titles[] = $event->renderEventTitle( $force_icon, $has_menu, @@ -533,12 +544,7 @@ final class PHUITimelineEventView extends AphrontView { Javelin::initBehavior('phabricator-watch-anchor'); Javelin::initBehavior('phabricator-tooltips'); - $anchor = id(new PhabricatorAnchorView()) - ->setAnchorName($this->anchor) - ->render(); - $date = array( - $anchor, javelin_tag( 'a', array( @@ -546,7 +552,7 @@ final class PHUITimelineEventView extends AphrontView { 'sigil' => 'has-tooltip', 'meta' => array( 'tip' => $content_source, - ), + ), ), $date), ); From 39b618039f390fb748b87decda1ba8d0893a3c18 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 12 Dec 2016 23:22:21 +0000 Subject: [PATCH 12/78] Remove a very old piece of config documentation Summary: Ref T571. This was accidentally left behind in D12266. Test Plan: Used {key command F} to search for "bulk". Reviewers: chad Reviewed By: chad Maniphest Tasks: T571 Differential Revision: https://secure.phabricator.com/D17034 --- .../config/option/PhabricatorMetaMTAConfigOptions.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php index 45604f6872..806cd02db3 100644 --- a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php +++ b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php @@ -98,16 +98,6 @@ EODOC You can disable the "To:" and "Cc:" footers in mail if users prefer smaller messages. EODOC -)); - - $bulk_description = $this->deformat(pht(<<deformat(pht(<< Date: Mon, 12 Dec 2016 15:15:05 -0800 Subject: [PATCH 13/78] Add authorPHID to Dashboards Summary: Adds an authorPHIDs, populates olds ones. Test Plan: Make a new Dashboard, see that I created it. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17022 --- .../20161210.dashboards.01.author.php | 39 +++++++++++++++++++ .../20161210.dashboards.01.author.sql | 2 + .../query/PhabricatorDashboardQuery.php | 13 +++++++ .../PhabricatorDashboardSearchEngine.php | 29 ++++++++++++-- .../storage/PhabricatorDashboard.php | 3 ++ 5 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 resources/sql/autopatches/20161210.dashboards.01.author.php create mode 100644 resources/sql/autopatches/20161210.dashboards.01.author.sql diff --git a/resources/sql/autopatches/20161210.dashboards.01.author.php b/resources/sql/autopatches/20161210.dashboards.01.author.php new file mode 100644 index 0000000000..84f6fbf8d7 --- /dev/null +++ b/resources/sql/autopatches/20161210.dashboards.01.author.php @@ -0,0 +1,39 @@ +establishConnection('w'); + +$txn_table = new PhabricatorDashboardTransaction(); +$txn_conn = $table->establishConnection('r'); + +echo pht("Building Dashboard authorPHIDs...\n"); + +foreach (new LiskMigrationIterator($table) as $dashboard) { + + if ($dashboard->getAuthorPHID()) { + continue; + } + + $author_row = queryfx_one( + $txn_conn, + 'SELECT authorPHID FROM %T WHERE objectPHID = %s ORDER BY id ASC LIMIT 1', + $txn_table->getTableName(), + $dashboard->getPHID()); + + if (!$author_row) { + $author_phid = id(new PhabricatorDashboardApplication())->getPHID(); + } else { + $author_phid = $author_row['authorPHID']; + } + + queryfx( + $conn_w, + 'UPDATE %T SET authorPHID = %s WHERE id = %d', + $table->getTableName(), + $author_phid, + $dashboard->getID()); +} + +echo pht("Done\n"); diff --git a/resources/sql/autopatches/20161210.dashboards.01.author.sql b/resources/sql/autopatches/20161210.dashboards.01.author.sql new file mode 100644 index 0000000000..405ed5727c --- /dev/null +++ b/resources/sql/autopatches/20161210.dashboards.01.author.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_dashboard.dashboard + ADD authorPHID VARBINARY(64) NOT NULL; diff --git a/src/applications/dashboard/query/PhabricatorDashboardQuery.php b/src/applications/dashboard/query/PhabricatorDashboardQuery.php index 55cd447c7a..a250d646d0 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardQuery.php +++ b/src/applications/dashboard/query/PhabricatorDashboardQuery.php @@ -6,6 +6,7 @@ final class PhabricatorDashboardQuery private $ids; private $phids; private $statuses; + private $authorPHIDs; private $needPanels; private $needProjects; @@ -25,6 +26,11 @@ final class PhabricatorDashboardQuery return $this; } + public function withAuthorPHIDs(array $authors) { + $this->authorPHIDs = $authors; + return $this; + } + public function needPanels($need_panels) { $this->needPanels = $need_panels; return $this; @@ -121,6 +127,13 @@ final class PhabricatorDashboardQuery $this->statuses); } + if ($this->authorPHIDs !== null) { + $where[] = qsprintf( + $conn, + 'authorPHID IN (%Ls)', + $this->authorPHIDs); + } + return $where; } diff --git a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php index 26c71c1bab..70325de3bb 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php @@ -18,6 +18,10 @@ final class PhabricatorDashboardSearchEngine protected function buildCustomSearchFields() { return array( + id(new PhabricatorSearchDatasourceField()) + ->setLabel(pht('Authored By')) + ->setKey('authorPHIDs') + ->setDatasource(new PhabricatorPeopleUserFunctionDatasource()), id(new PhabricatorSearchCheckboxesField()) ->setKey('statuses') ->setLabel(pht('Status')) @@ -30,19 +34,32 @@ final class PhabricatorDashboardSearchEngine } protected function getBuiltinQueryNames() { - return array( - 'open' => pht('Active Dashboards'), - 'all' => pht('All Dashboards'), - ); + $names = array(); + + if ($this->requireViewer()->isLoggedIn()) { + $names['authored'] = pht('Authored'); + } + + $names['open'] = pht('Active Dashboards'); + $names['all'] = pht('All Dashboards'); + + return $names; } public function buildSavedQueryFromBuiltin($query_key) { $query = $this->newSavedQuery(); $query->setQueryKey($query_key); + $viewer = $this->requireViewer(); switch ($query_key) { case 'all': return $query; + case 'authored': + return $query->setParameter( + 'authored', + array( + $viewer->getPHID(), + )); case 'open': return $query->setParameter( 'statuses', @@ -61,6 +78,10 @@ final class PhabricatorDashboardSearchEngine $query->withStatuses($map['statuses']); } + if ($map['authorPHIDs']) { + $query->withAuthorPHIDs($map['authorPHIDs']); + } + return $query; } diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php index 2930ca7674..fab431764a 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboard.php +++ b/src/applications/dashboard/storage/PhabricatorDashboard.php @@ -12,6 +12,7 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO PhabricatorProjectInterface { protected $name; + protected $authorPHID; protected $viewPolicy; protected $editPolicy; protected $status; @@ -31,6 +32,7 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO ->setViewPolicy(PhabricatorPolicies::POLICY_USER) ->setEditPolicy($actor->getPHID()) ->setStatus(self::STATUS_ACTIVE) + ->setAuthorPHID($actor->getPHID()) ->attachPanels(array()) ->attachPanelPHIDs(array()); } @@ -61,6 +63,7 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO self::CONFIG_COLUMN_SCHEMA => array( 'name' => 'text255', 'status' => 'text32', + 'authorPHID' => 'phid', ), ) + parent::getConfiguration(); } From 776a1f3aec35c4d8f98a49201cce6934022d61d7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 12 Dec 2016 15:44:28 -0800 Subject: [PATCH 14/78] Rename dashboard author patches so that the backfill patch happens after the column it is adding is created Auditors: chad --- ...dashboards.01.author.php => 20161210.dashboards.02.author.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename resources/sql/autopatches/{20161210.dashboards.01.author.php => 20161210.dashboards.02.author.php} (100%) diff --git a/resources/sql/autopatches/20161210.dashboards.01.author.php b/resources/sql/autopatches/20161210.dashboards.02.author.php similarity index 100% rename from resources/sql/autopatches/20161210.dashboards.01.author.php rename to resources/sql/autopatches/20161210.dashboards.02.author.php From 8a2afa14d24f3cc9feaefbf62e65e0a8f3cc5333 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 04:55:53 -0800 Subject: [PATCH 15/78] Make the documentation more clear that storage.mysql-engine.max-size is measured in bytes Summary: Fixes T12001. I think we're consistent about using bytes everywhere, but users won't necessarily know that and this documentation could certainly be more clear. Test Plan: Read new text. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12001 Differential Revision: https://secure.phabricator.com/D17037 --- .../user/configuration/configuring_file_storage.diviner | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/docs/user/configuration/configuring_file_storage.diviner b/src/docs/user/configuration/configuring_file_storage.diviner index 64942b493e..d6abb22c13 100644 --- a/src/docs/user/configuration/configuring_file_storage.diviner +++ b/src/docs/user/configuration/configuring_file_storage.diviner @@ -133,15 +133,15 @@ Engine: MySQL MySQL storage is configured by default, for files up to (just under) 1MB. You can configure it with these keys: - - `storage.mysql-engine.max-size`: Change the filesize limit. Set to 0 - to disable. + - `storage.mysql-engine.max-size`: Change the filesize limit, in bytes. Set + to 0 to disable. For most installs, it is reasonable to leave this engine as-is and let small files (like thumbnails and profile images) be stored in MySQL, which is usually the lowest-latency filestore, even if you configure another storage engine. -To support large files, increase this limit to at least **8MB**. This will -activate chunk storage in MySQL. +To support large files, increase this limit to at least `8388608` (8MB). +This will activate chunk storage in MySQL. Engine: Local Disk ================== From c03a412d5c4d2efd005adbef0cc683375a8e2149 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 13 Dec 2016 09:51:25 -0800 Subject: [PATCH 16/78] Add authorPHID to Dashboard Panels Summary: Adds authorPHID to panels so we can default to the panels you made. Test Plan: Run upgrade, visit manage panels, see my panels. Create a new panel. Edit a panel. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17036 --- .../20161212.dashboardpanel.01.author.sql | 2 + .../20161212.dashboardpanel.02.author.php | 39 +++++++++++++++++++ ...habricatorDashboardPanelEditController.php | 2 +- .../query/PhabricatorDashboardPanelQuery.php | 13 +++++++ .../PhabricatorDashboardPanelSearchEngine.php | 29 ++++++++++++-- .../PhabricatorDashboardSearchEngine.php | 2 +- .../storage/PhabricatorDashboardPanel.php | 7 +++- 7 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 resources/sql/autopatches/20161212.dashboardpanel.01.author.sql create mode 100644 resources/sql/autopatches/20161212.dashboardpanel.02.author.php diff --git a/resources/sql/autopatches/20161212.dashboardpanel.01.author.sql b/resources/sql/autopatches/20161212.dashboardpanel.01.author.sql new file mode 100644 index 0000000000..00c52d19cb --- /dev/null +++ b/resources/sql/autopatches/20161212.dashboardpanel.01.author.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_dashboard.dashboard_panel + ADD authorPHID VARBINARY(64) NOT NULL; diff --git a/resources/sql/autopatches/20161212.dashboardpanel.02.author.php b/resources/sql/autopatches/20161212.dashboardpanel.02.author.php new file mode 100644 index 0000000000..bc87aef91c --- /dev/null +++ b/resources/sql/autopatches/20161212.dashboardpanel.02.author.php @@ -0,0 +1,39 @@ +establishConnection('w'); + +$txn_table = new PhabricatorDashboardPanelTransaction(); +$txn_conn = $table->establishConnection('r'); + +echo pht("Building Dashboard Panel authorPHIDs...\n"); + +foreach (new LiskMigrationIterator($table) as $panel) { + + if ($panel->getAuthorPHID()) { + continue; + } + + $panel_row = queryfx_one( + $txn_conn, + 'SELECT authorPHID FROM %T WHERE objectPHID = %s ORDER BY id ASC LIMIT 1', + $txn_table->getTableName(), + $panel->getPHID()); + + if (!$panel_row) { + $author_phid = id(new PhabricatorDashboardApplication())->getPHID(); + } else { + $author_phid = $panel_row['authorPHID']; + } + + queryfx( + $conn_w, + 'UPDATE %T SET authorPHID = %s WHERE id = %d', + $table->getTableName(), + $author_phid, + $panel->getID()); +} + +echo pht("Done\n"); diff --git a/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php b/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php index b85498c13c..787d1c63ee 100644 --- a/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php @@ -400,7 +400,7 @@ final class PhabricatorDashboardPanelEditController $viewer = $request->getUser(); $copy = PhabricatorDashboardPanel::initializeNewPanel($viewer); - $copy = PhabricatorDashboardPanel::copyPanel($copy, $panel); + $copy = PhabricatorDashboardPanel::copyPanel($copy, $panel, $viewer); $copy->openTransaction(); $copy->save(); diff --git a/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php b/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php index 3a6589a32c..6fbdb3d99c 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php +++ b/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php @@ -7,6 +7,7 @@ final class PhabricatorDashboardPanelQuery private $phids; private $archived; private $panelTypes; + private $authorPHIDs; public function withIDs(array $ids) { $this->ids = $ids; @@ -28,6 +29,11 @@ final class PhabricatorDashboardPanelQuery return $this; } + public function withAuthorPHIDs(array $authors) { + $this->authorPHIDs = $authors; + return $this; + } + protected function loadPage() { return $this->loadStandardPage($this->newResultObject()); } @@ -75,6 +81,13 @@ final class PhabricatorDashboardPanelQuery $this->panelTypes); } + if ($this->authorPHIDs !== null) { + $where[] = qsprintf( + $conn, + 'authorPHID IN (%Ls)', + $this->authorPHIDs); + } + return $where; } diff --git a/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php index 113ed8ff94..d9fe25ab02 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php @@ -34,12 +34,20 @@ final class PhabricatorDashboardPanelSearchEngine $query->withPanelTypes(array($map['paneltype'])); } + if ($map['authorPHIDs']) { + $query->withAuthorPHIDs($map['authorPHIDs']); + } + return $query; } protected function buildCustomSearchFields() { return array( + id(new PhabricatorSearchDatasourceField()) + ->setLabel(pht('Authored By')) + ->setKey('authorPHIDs') + ->setDatasource(new PhabricatorPeopleUserFunctionDatasource()), id(new PhabricatorSearchSelectField()) ->setKey('status') ->setLabel(pht('Status')) @@ -60,19 +68,32 @@ final class PhabricatorDashboardPanelSearchEngine } protected function getBuiltinQueryNames() { - return array( - 'active' => pht('Active Panels'), - 'all' => pht('All Panels'), - ); + $names = array(); + + if ($this->requireViewer()->isLoggedIn()) { + $names['authored'] = pht('Authored'); + } + + $names['active'] = pht('Active Panels'); + $names['all'] = pht('All Panels'); + + return $names; } public function buildSavedQueryFromBuiltin($query_key) { $query = $this->newSavedQuery(); $query->setQueryKey($query_key); + $viewer = $this->requireViewer(); switch ($query_key) { case 'active': return $query->setParameter('status', 'active'); + case 'authored': + return $query->setParameter( + 'authorPHIDs', + array( + $viewer->getPHID(), + )); case 'all': return $query; } diff --git a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php index 70325de3bb..389bbb6bdc 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php @@ -56,7 +56,7 @@ final class PhabricatorDashboardSearchEngine return $query; case 'authored': return $query->setParameter( - 'authored', + 'authorPHIDs', array( $viewer->getPHID(), )); diff --git a/src/applications/dashboard/storage/PhabricatorDashboardPanel.php b/src/applications/dashboard/storage/PhabricatorDashboardPanel.php index 64e6ea5b87..6067abf79f 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboardPanel.php +++ b/src/applications/dashboard/storage/PhabricatorDashboardPanel.php @@ -16,6 +16,7 @@ final class PhabricatorDashboardPanel protected $panelType; protected $viewPolicy; protected $editPolicy; + protected $authorPHID; protected $isArchived = 0; protected $properties = array(); @@ -24,17 +25,20 @@ final class PhabricatorDashboardPanel public static function initializeNewPanel(PhabricatorUser $actor) { return id(new PhabricatorDashboardPanel()) ->setName('') + ->setAuthorPHID($actor->getPHID()) ->setViewPolicy(PhabricatorPolicies::POLICY_USER) ->setEditPolicy($actor->getPHID()); } public static function copyPanel( PhabricatorDashboardPanel $dst, - PhabricatorDashboardPanel $src) { + PhabricatorDashboardPanel $src, + PhabricatorUser $user) { $dst->name = $src->name; $dst->panelType = $src->panelType; $dst->properties = $src->properties; + $dst->authorPHID = $user->getPHID(); return $dst; } @@ -48,6 +52,7 @@ final class PhabricatorDashboardPanel self::CONFIG_COLUMN_SCHEMA => array( 'name' => 'text255', 'panelType' => 'text64', + 'authorPHID' => 'phid', 'isArchived' => 'bool', ), ) + parent::getConfiguration(); From 26127b9c5f7be06afd76f1bbf04c7d83ea42e175 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 13 Dec 2016 10:52:19 -0800 Subject: [PATCH 17/78] Allow Dashboards to set an icon Summary: Allows users set an icon (for reuse on upcoming home) for their dashboard based on 16 descriminating choices. Test Plan: Create a new dashboard, set new icon. Edit an existing dashboard, set icon. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17042 --- .../20161212.dashboards.01.icon.sql | 5 +++ src/__phutil_library_map__.php | 2 + .../PhabricatorDashboardEditController.php | 12 +++++ .../PhabricatorDashboardManageController.php | 2 +- .../PhabricatorDashboardTransactionEditor.php | 11 +++++ .../icon/PhabricatorDashboardIconSet.php | 45 +++++++++++++++++++ .../storage/PhabricatorDashboard.php | 3 ++ .../PhabricatorDashboardTransaction.php | 29 ++++++++++++ 8 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 resources/sql/autopatches/20161212.dashboards.01.icon.sql create mode 100644 src/applications/dashboard/icon/PhabricatorDashboardIconSet.php diff --git a/resources/sql/autopatches/20161212.dashboards.01.icon.sql b/resources/sql/autopatches/20161212.dashboards.01.icon.sql new file mode 100644 index 0000000000..e2783ab5bc --- /dev/null +++ b/resources/sql/autopatches/20161212.dashboards.01.icon.sql @@ -0,0 +1,5 @@ +ALTER TABLE {$NAMESPACE}_dashboard.dashboard + ADD icon VARCHAR(32) NOT NULL; + +UPDATE {$NAMESPACE}_dashboard.dashboard + SET icon = 'fa-dashboard'; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index f064ab8255..ee278c21dd 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2426,6 +2426,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardDashboardHasPanelEdgeType.php', 'PhabricatorDashboardDashboardPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardDashboardPHIDType.php', 'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php', + 'PhabricatorDashboardIconSet' => 'applications/dashboard/icon/PhabricatorDashboardIconSet.php', 'PhabricatorDashboardInstall' => 'applications/dashboard/storage/PhabricatorDashboardInstall.php', 'PhabricatorDashboardInstallController' => 'applications/dashboard/controller/PhabricatorDashboardInstallController.php', 'PhabricatorDashboardLayoutConfig' => 'applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php', @@ -7364,6 +7365,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'PhabricatorEdgeType', 'PhabricatorDashboardDashboardPHIDType' => 'PhabricatorPHIDType', 'PhabricatorDashboardEditController' => 'PhabricatorDashboardController', + 'PhabricatorDashboardIconSet' => 'PhabricatorIconSet', 'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO', 'PhabricatorDashboardInstallController' => 'PhabricatorDashboardController', 'PhabricatorDashboardLayoutConfig' => 'Phobject', diff --git a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php index 8438d0442b..a167c91188 100644 --- a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php @@ -67,12 +67,14 @@ final class PhabricatorDashboardEditController } $v_name = $dashboard->getName(); + $v_icon = $dashboard->getIcon(); $v_layout_mode = $dashboard->getLayoutConfigObject()->getLayoutMode(); $e_name = true; $validation_exception = null; if ($request->isFormPost() && $request->getStr('edit')) { $v_name = $request->getStr('name'); + $v_icon = $request->getStr('icon'); $v_layout_mode = $request->getStr('layout_mode'); $v_view_policy = $request->getStr('viewPolicy'); $v_edit_policy = $request->getStr('editPolicy'); @@ -81,6 +83,7 @@ final class PhabricatorDashboardEditController $xactions = array(); $type_name = PhabricatorDashboardTransaction::TYPE_NAME; + $type_icon = PhabricatorDashboardTransaction::TYPE_ICON; $type_layout_mode = PhabricatorDashboardTransaction::TYPE_LAYOUT_MODE; $type_view_policy = PhabricatorTransactions::TYPE_VIEW_POLICY; $type_edit_policy = PhabricatorTransactions::TYPE_EDIT_POLICY; @@ -91,6 +94,9 @@ final class PhabricatorDashboardEditController $xactions[] = id(new PhabricatorDashboardTransaction()) ->setTransactionType($type_layout_mode) ->setNewValue($v_layout_mode); + $xactions[] = id(new PhabricatorDashboardTransaction()) + ->setTransactionType($type_icon) + ->setNewValue($v_icon); $xactions[] = id(new PhabricatorDashboardTransaction()) ->setTransactionType($type_view_policy) ->setNewValue($v_view_policy); @@ -146,6 +152,12 @@ final class PhabricatorDashboardEditController ->setName('layout_mode') ->setValue($v_layout_mode) ->setOptions($layout_mode_options)) + ->appendChild( + id(new PHUIFormIconSetControl()) + ->setLabel(pht('Icon')) + ->setName('icon') + ->setIconSet(new PhabricatorDashboardIconSet()) + ->setValue($v_icon)) ->appendChild( id(new AphrontFormPolicyControl()) ->setName('viewPolicy') diff --git a/src/applications/dashboard/controller/PhabricatorDashboardManageController.php b/src/applications/dashboard/controller/PhabricatorDashboardManageController.php index 4e31b2d2ae..9724db21f7 100644 --- a/src/applications/dashboard/controller/PhabricatorDashboardManageController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardManageController.php @@ -109,7 +109,7 @@ final class PhabricatorDashboardManageController ->setHeader($dashboard->getName()) ->setPolicyObject($dashboard) ->setStatus($status_icon, $status_color, $status_name) - ->setHeaderIcon('fa-dashboard') + ->setHeaderIcon($dashboard->getIcon()) ->addActionLink($button); } diff --git a/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php b/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php index 6cb7810d0b..792f6f9aa5 100644 --- a/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php +++ b/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php @@ -51,6 +51,7 @@ final class PhabricatorDashboardTransactionEditor $types[] = PhabricatorTransactions::TYPE_EDGE; $types[] = PhabricatorDashboardTransaction::TYPE_NAME; + $types[] = PhabricatorDashboardTransaction::TYPE_ICON; $types[] = PhabricatorDashboardTransaction::TYPE_STATUS; $types[] = PhabricatorDashboardTransaction::TYPE_LAYOUT_MODE; @@ -66,6 +67,11 @@ final class PhabricatorDashboardTransactionEditor return null; } return $object->getName(); + case PhabricatorDashboardTransaction::TYPE_ICON: + if ($this->getIsNewObject()) { + return null; + } + return $object->getIcon(); case PhabricatorDashboardTransaction::TYPE_STATUS: if ($this->getIsNewObject()) { return null; @@ -87,6 +93,7 @@ final class PhabricatorDashboardTransactionEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorDashboardTransaction::TYPE_NAME: + case PhabricatorDashboardTransaction::TYPE_ICON: case PhabricatorDashboardTransaction::TYPE_STATUS: case PhabricatorDashboardTransaction::TYPE_LAYOUT_MODE: return $xaction->getNewValue(); @@ -101,6 +108,9 @@ final class PhabricatorDashboardTransactionEditor case PhabricatorDashboardTransaction::TYPE_NAME: $object->setName($xaction->getNewValue()); return; + case PhabricatorDashboardTransaction::TYPE_ICON: + $object->setIcon($xaction->getNewValue()); + return; case PhabricatorDashboardTransaction::TYPE_STATUS: $object->setStatus($xaction->getNewValue()); return; @@ -130,6 +140,7 @@ final class PhabricatorDashboardTransactionEditor switch ($xaction->getTransactionType()) { case PhabricatorDashboardTransaction::TYPE_NAME: + case PhabricatorDashboardTransaction::TYPE_ICON: case PhabricatorDashboardTransaction::TYPE_STATUS: case PhabricatorDashboardTransaction::TYPE_LAYOUT_MODE: return; diff --git a/src/applications/dashboard/icon/PhabricatorDashboardIconSet.php b/src/applications/dashboard/icon/PhabricatorDashboardIconSet.php new file mode 100644 index 0000000000..1bd12609b7 --- /dev/null +++ b/src/applications/dashboard/icon/PhabricatorDashboardIconSet.php @@ -0,0 +1,45 @@ + pht('Home'), + 'fa-th-large' => pht('Blocks'), + 'fa-columns' => pht('Columns'), + 'fa-bookmark' => pht('Page Saver'), + + 'fa-book' => pht('Knowledge'), + 'fa-bomb' => pht('Kaboom'), + 'fa-pie-chart' => pht('Apple Blueberry'), + 'fa-bar-chart' => pht('Serious Business'), + + 'fa-bell' => pht('Ding Ding'), + 'fa-credit-card' => pht('Plastic Debt'), + 'fa-code' => pht('PHP is Life'), + 'fa-sticky-note' => pht('To Self'), + + 'fa-newspaper-o' => pht('Stay Woke'), + 'fa-server' => pht('Metallica'), + 'fa-hashtag' => pht('Corned Beef'), + 'fa-group' => pht('Triplets'), + ); + + $icons = array(); + foreach ($map as $key => $label) { + $icons[] = id(new PhabricatorIconSetIcon()) + ->setKey($key) + ->setLabel($label); + } + + return $icons; + } + +} diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php index fab431764a..abba22498f 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboard.php +++ b/src/applications/dashboard/storage/PhabricatorDashboard.php @@ -16,6 +16,7 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO protected $viewPolicy; protected $editPolicy; protected $status; + protected $icon; protected $layoutConfig = array(); const STATUS_ACTIVE = 'active'; @@ -29,6 +30,7 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO public static function initializeNewDashboard(PhabricatorUser $actor) { return id(new PhabricatorDashboard()) ->setName('') + ->setIcon('fa-dashboard') ->setViewPolicy(PhabricatorPolicies::POLICY_USER) ->setEditPolicy($actor->getPHID()) ->setStatus(self::STATUS_ACTIVE) @@ -63,6 +65,7 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO self::CONFIG_COLUMN_SCHEMA => array( 'name' => 'text255', 'status' => 'text32', + 'icon' => 'text32', 'authorPHID' => 'phid', ), ) + parent::getConfiguration(); diff --git a/src/applications/dashboard/storage/PhabricatorDashboardTransaction.php b/src/applications/dashboard/storage/PhabricatorDashboardTransaction.php index 70b5963f03..1511078f11 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboardTransaction.php +++ b/src/applications/dashboard/storage/PhabricatorDashboardTransaction.php @@ -4,6 +4,7 @@ final class PhabricatorDashboardTransaction extends PhabricatorApplicationTransaction { const TYPE_NAME = 'dashboard:name'; + const TYPE_ICON = 'dashboard:icon'; const TYPE_STATUS = 'dashboard:status'; const TYPE_LAYOUT_MODE = 'dashboard:layoutmode'; @@ -39,6 +40,19 @@ final class PhabricatorDashboardTransaction $new); } break; + case self::TYPE_ICON: + if (!strlen($old)) { + return pht( + '%s set the dashboard icon.', + $author_link); + } else { + return pht( + '%s changed this dashboard icon from "%s" to "%s".', + $author_link, + $old, + $new); + } + break; case self::TYPE_STATUS: if ($new == PhabricatorDashboard::STATUS_ACTIVE) { return pht( @@ -82,6 +96,21 @@ final class PhabricatorDashboardTransaction $new); } break; + case self::TYPE_ICON: + if (!strlen($old)) { + return pht( + '%s set dashboard icon for %s.', + $author_link, + $object_link); + } else { + return pht( + '%s set the dashboard icon on %s from "%s" to "%s".', + $author_link, + $object_link, + $old, + $new); + } + break; case self::TYPE_STATUS: if ($new == PhabricatorDashboard::STATUS_ACTIVE) { return pht( From 842710608e49693a059f37a1d76197ac77c424b4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 14:02:04 -0800 Subject: [PATCH 18/78] Don't combine automatic output compression with "Content-Length" Summary: Fixes T12013. Send either "Content-Length" or enable output compression, but not both. Prefer compression for static resources (CSS, JS, etc). Test Plan: Ran `curl -v ...`, no longer saw responses with both compression and `Content-Length`. Reviewers: chad, avivey Reviewed By: avivey Subscribers: avivey Maniphest Tasks: T12013 Differential Revision: https://secure.phabricator.com/D17045 --- src/aphront/response/AphrontFileResponse.php | 18 +++++++++++++++++- src/aphront/response/AphrontResponse.php | 15 +++++++++++++++ src/aphront/sink/AphrontHTTPSink.php | 2 ++ .../controller/CelerityResourceController.php | 7 ++++--- support/PhabricatorStartup.php | 5 ----- 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/aphront/response/AphrontFileResponse.php b/src/aphront/response/AphrontFileResponse.php index 4688e3bc8f..a8f673d218 100644 --- a/src/aphront/response/AphrontFileResponse.php +++ b/src/aphront/response/AphrontFileResponse.php @@ -5,6 +5,7 @@ final class AphrontFileResponse extends AphrontResponse { private $content; private $contentIterator; private $contentLength; + private $compressResponse; private $mimeType; private $download; @@ -69,6 +70,15 @@ final class AphrontFileResponse extends AphrontResponse { return $this->contentLength; } + public function setCompressResponse($compress_response) { + $this->compressResponse = $compress_response; + return $this; + } + + public function getCompressResponse() { + return $this->compressResponse; + } + public function setRange($min, $max) { $this->rangeMin = $min; $this->rangeMax = $max; @@ -94,7 +104,9 @@ final class AphrontFileResponse extends AphrontResponse { $content_len = $this->getContentLength(); } - $headers[] = array('Content-Length', $this->getContentLength()); + if (!$this->shouldCompressResponse()) { + $headers[] = array('Content-Length', $this->getContentLength()); + } if (strlen($this->getDownload())) { $headers[] = array('X-Download-Options', 'noopen'); @@ -118,4 +130,8 @@ final class AphrontFileResponse extends AphrontResponse { return $headers; } + protected function shouldCompressResponse() { + return $this->getCompressResponse(); + } + } diff --git a/src/aphront/response/AphrontResponse.php b/src/aphront/response/AphrontResponse.php index b213244f1c..6c52e417e3 100644 --- a/src/aphront/response/AphrontResponse.php +++ b/src/aphront/response/AphrontResponse.php @@ -242,6 +242,21 @@ abstract class AphrontResponse extends Phobject { return gmdate('D, d M Y H:i:s', $epoch_timestamp).' GMT'; } + protected function shouldCompressResponse() { + return true; + } + + public function willBeginWrite() { + if ($this->shouldCompressResponse()) { + // Enable automatic compression here. Webservers sometimes do this for + // us, but we now detect the absence of compression and warn users about + // it so try to cover our bases more thoroughly. + ini_set('zlib.output_compression', 1); + } else { + ini_set('zlib.output_compression', 0); + } + } + public function didCompleteWrite($aborted) { return; } diff --git a/src/aphront/sink/AphrontHTTPSink.php b/src/aphront/sink/AphrontHTTPSink.php index 4a729da16e..11c6466cf1 100644 --- a/src/aphront/sink/AphrontHTTPSink.php +++ b/src/aphront/sink/AphrontHTTPSink.php @@ -96,6 +96,8 @@ abstract class AphrontHTTPSink extends Phobject { * @return void */ final public function writeResponse(AphrontResponse $response) { + $response->willBeginWrite(); + // Build the content iterator first, in case it throws. Ideally, we'd // prefer to handle exceptions before we emit the response status or any // HTTP headers. diff --git a/src/applications/celerity/controller/CelerityResourceController.php b/src/applications/celerity/controller/CelerityResourceController.php index 95d674c641..0f1478ec5c 100644 --- a/src/applications/celerity/controller/CelerityResourceController.php +++ b/src/applications/celerity/controller/CelerityResourceController.php @@ -103,9 +103,10 @@ abstract class CelerityResourceController extends PhabricatorController { } } - $response = new AphrontFileResponse(); - $response->setContent($data); - $response->setMimeType($type_map[$type]); + $response = id(new AphrontFileResponse()) + ->setContent($data) + ->setMimeType($type_map[$type]) + ->setCompressResponse(true); // NOTE: This is a piece of magic required to make WOFF fonts work in // Firefox and IE. Possibly we should generalize this more. diff --git a/support/PhabricatorStartup.php b/support/PhabricatorStartup.php index 26c6b26a9c..0a27a616e3 100644 --- a/support/PhabricatorStartup.php +++ b/support/PhabricatorStartup.php @@ -395,11 +395,6 @@ final class PhabricatorStartup { if (function_exists('libxml_disable_entity_loader')) { libxml_disable_entity_loader(true); } - - // Enable automatic compression here. Webservers sometimes do this for - // us, but we now detect the absence of compression and warn users about - // it so try to cover our bases more thoroughly. - ini_set('zlib.output_compression', 1); } From 9d2feacfabb7f26b7d1d5c0abfb485373b1ed9a6 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 14:24:23 -0800 Subject: [PATCH 19/78] Rename a missed Profile -> MenuItem Summary: Didn't grep this good enough. Test Plan: `bin/storage upgrade -f --apply ..`, got a clean apply. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D17046 --- resources/sql/autopatches/20160122.project.1.boarddefault.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/sql/autopatches/20160122.project.1.boarddefault.php b/resources/sql/autopatches/20160122.project.1.boarddefault.php index 8765184629..500c820827 100644 --- a/resources/sql/autopatches/20160122.project.1.boarddefault.php +++ b/resources/sql/autopatches/20160122.project.1.boarddefault.php @@ -7,7 +7,7 @@ $project_table = new PhabricatorProject(); $conn_w = $project_table->establishConnection('w'); -$panel_table = id(new PhabricatorProfilePanelConfiguration()); +$panel_table = id(new PhabricatorProfileMenuItemConfiguration()); $panel_conn = $panel_table->establishConnection('w'); foreach (new LiskMigrationIterator($project_table) as $project) { From fc6bfbdb103f0f66e5782c34510956b080268e81 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 09:29:12 -0800 Subject: [PATCH 20/78] Truncate the one-line diff update summary when updating a revision to 250 bytes Summary: Fixes T7899. If you create or update a revision and type an enormously long first line, we currently fatal trying to insert it into the database. This text is only used to show a single-line summary of the diff in the "History" tab, which should probably be updated anyway. For now, stop fataling. Test Plan: Uploaded a diff with the description "MMMM..." (thousands of them). Before patch: fatal on description being too long. After patch: beautiful "MMMM" summary. Reviewers: chad Reviewed By: chad Maniphest Tasks: T7899 Differential Revision: https://secure.phabricator.com/D17038 --- .../conduit/DifferentialConduitAPIMethod.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php index fdcf4395dd..111e0f04b4 100644 --- a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php @@ -124,8 +124,15 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod { $message = $request->getValue('message'); if (strlen($message)) { // This is a little awkward, and should maybe move inside the transaction - // editor. It largely exists for legacy reasons. + // editor. It largely exists for legacy reasons. See some discussion in + // T7899. $first_line = head(phutil_split_lines($message, false)); + + $first_line = id(new PhutilUTF8StringTruncator()) + ->setMaximumBytes(250) + ->setMaximumGlyphs(80) + ->truncateString($first_line); + $diff->setDescription($first_line); $diff->save(); From c67e87c8093e415092f4cc07d31aff46c40d5e46 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 10:01:41 -0800 Subject: [PATCH 21/78] Force hunk storage migration to the modern format Summary: Ref T8475. This forces installs to migrate hunks to the modern format. We stopped writing to the legacy format a very long time ago (2+ years?) without issues. This doesn't destroy any data. T8623 has guidance and I'll publish more changelog guidance. Test Plan: Faked some legacy data and migrated it. Reviewers: chad Reviewed By: chad Maniphest Tasks: T8475 Differential Revision: https://secure.phabricator.com/D17039 --- .../autopatches/20161213.diff.01.hunks.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 resources/sql/autopatches/20161213.diff.01.hunks.php diff --git a/resources/sql/autopatches/20161213.diff.01.hunks.php b/resources/sql/autopatches/20161213.diff.01.hunks.php new file mode 100644 index 0000000000..c6394defce --- /dev/null +++ b/resources/sql/autopatches/20161213.diff.01.hunks.php @@ -0,0 +1,38 @@ +establishConnection('w'); +$src_table = 'differential_hunk'; +$dst_table = 'differential_hunk_modern'; + +echo tsprintf( + "%s\n", + pht('Migrating old hunks...')); + +foreach (new LiskRawMigrationIterator($conn, $src_table) as $row) { + queryfx( + $conn, + 'INSERT INTO %T + (changesetID, oldOffset, oldLen, newOffset, newLen, + dataType, dataEncoding, dataFormat, data, + dateCreated, dateModified) + VALUES + (%d, %d, %d, %d, %d, + %s, %s, %s, %s, + %d, %d)', + $dst_table, + $row['changesetID'], + $row['oldOffset'], + $row['oldLen'], + $row['newOffset'], + $row['newLen'], + DifferentialModernHunk::DATATYPE_TEXT, + 'utf8', + DifferentialModernHunk::DATAFORMAT_RAW, + $row['changes'], + $row['dateCreated'], + $row['dateModified']); +} + +echo tsprintf( + "%s\n", + pht('Done.')); From 1e9a462baac35314ede3e5ecadbac200dec9e7b6 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 10:01:49 -0800 Subject: [PATCH 22/78] Remove most of the legacy hunk code Summary: Ref T8475. This gets rid of most of the old "legacy hunk" code. I'll nuke the rest (and drop the old table) once we're more sure that we're in the clear. Test Plan: Browsed Differential. Reviewers: chad Reviewed By: chad Maniphest Tasks: T8475 Differential Revision: https://secure.phabricator.com/D17040 --- bin/hunks | 1 - scripts/setup/manage_hunks.php | 21 ------- src/__phutil_library_map__.php | 4 -- ...bricatorHunksManagementMigrateWorkflow.php | 60 ------------------- .../PhabricatorHunksManagementWorkflow.php | 4 -- .../query/DifferentialHunkQuery.php | 16 +---- .../storage/DifferentialChangeset.php | 7 --- 7 files changed, 1 insertion(+), 112 deletions(-) delete mode 120000 bin/hunks delete mode 100755 scripts/setup/manage_hunks.php delete mode 100644 src/applications/differential/management/PhabricatorHunksManagementMigrateWorkflow.php delete mode 100644 src/applications/differential/management/PhabricatorHunksManagementWorkflow.php diff --git a/bin/hunks b/bin/hunks deleted file mode 120000 index dc2cf5492e..0000000000 --- a/bin/hunks +++ /dev/null @@ -1 +0,0 @@ -../scripts/setup/manage_hunks.php \ No newline at end of file diff --git a/scripts/setup/manage_hunks.php b/scripts/setup/manage_hunks.php deleted file mode 100755 index a2d35779de..0000000000 --- a/scripts/setup/manage_hunks.php +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env php -setTagline(pht('manage hunks')); -$args->setSynopsis(<<parseStandardArguments(); - -$workflows = id(new PhutilClassMapQuery()) - ->setAncestorClass('PhabricatorHunksManagementWorkflow') - ->execute(); -$workflows[] = new PhutilHelpArgumentWorkflow(); -$args->parseWorkflows($workflows); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ee278c21dd..976ccaed3c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2784,8 +2784,6 @@ phutil_register_library_map(array( 'PhabricatorHomeQuickCreateController' => 'applications/home/controller/PhabricatorHomeQuickCreateController.php', 'PhabricatorHovercardEngineExtension' => 'applications/search/engineextension/PhabricatorHovercardEngineExtension.php', 'PhabricatorHovercardEngineExtensionModule' => 'applications/search/engineextension/PhabricatorHovercardEngineExtensionModule.php', - 'PhabricatorHunksManagementMigrateWorkflow' => 'applications/differential/management/PhabricatorHunksManagementMigrateWorkflow.php', - 'PhabricatorHunksManagementWorkflow' => 'applications/differential/management/PhabricatorHunksManagementWorkflow.php', 'PhabricatorIDsSearchEngineExtension' => 'applications/search/engineextension/PhabricatorIDsSearchEngineExtension.php', 'PhabricatorIDsSearchField' => 'applications/search/field/PhabricatorIDsSearchField.php', 'PhabricatorIRCProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php', @@ -7777,8 +7775,6 @@ phutil_register_library_map(array( 'PhabricatorHomeQuickCreateController' => 'PhabricatorHomeController', 'PhabricatorHovercardEngineExtension' => 'Phobject', 'PhabricatorHovercardEngineExtensionModule' => 'PhabricatorConfigModule', - 'PhabricatorHunksManagementMigrateWorkflow' => 'PhabricatorHunksManagementWorkflow', - 'PhabricatorHunksManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorIDsSearchEngineExtension' => 'PhabricatorSearchEngineExtension', 'PhabricatorIDsSearchField' => 'PhabricatorSearchField', 'PhabricatorIRCProtocolAdapter' => 'PhabricatorProtocolAdapter', diff --git a/src/applications/differential/management/PhabricatorHunksManagementMigrateWorkflow.php b/src/applications/differential/management/PhabricatorHunksManagementMigrateWorkflow.php deleted file mode 100644 index 90c0be1717..0000000000 --- a/src/applications/differential/management/PhabricatorHunksManagementMigrateWorkflow.php +++ /dev/null @@ -1,60 +0,0 @@ -setName('migrate') - ->setExamples('**migrate**') - ->setSynopsis(pht('Migrate hunks to modern storage.')) - ->setArguments(array()); - } - - public function execute(PhutilArgumentParser $args) { - $saw_any_rows = false; - $console = PhutilConsole::getConsole(); - - $table = new DifferentialLegacyHunk(); - foreach (new LiskMigrationIterator($table) as $hunk) { - $saw_any_rows = true; - - $id = $hunk->getID(); - $console->writeOut("%s\n", pht('Migrating hunk %d...', $id)); - - $new_hunk = id(new DifferentialModernHunk()) - ->setChangesetID($hunk->getChangesetID()) - ->setOldOffset($hunk->getOldOffset()) - ->setOldLen($hunk->getOldLen()) - ->setNewOffset($hunk->getNewOffset()) - ->setNewLen($hunk->getNewLen()) - ->setChanges($hunk->getChanges()) - ->setDateCreated($hunk->getDateCreated()) - ->setDateModified($hunk->getDateModified()); - - $hunk->openTransaction(); - $new_hunk->save(); - $hunk->delete(); - $hunk->saveTransaction(); - - $old_len = strlen($hunk->getChanges()); - $new_len = strlen($new_hunk->getData()); - if ($old_len) { - $diff_len = ($old_len - $new_len); - $console->writeOut( - "%s\n", - pht( - 'Saved %s bytes (%s).', - new PhutilNumber($diff_len), - sprintf('%.1f%%', 100 * ($diff_len / $old_len)))); - } - } - - if ($saw_any_rows) { - $console->writeOut("%s\n", pht('Done.')); - } else { - $console->writeOut("%s\n", pht('No rows to migrate.')); - } - } - -} diff --git a/src/applications/differential/management/PhabricatorHunksManagementWorkflow.php b/src/applications/differential/management/PhabricatorHunksManagementWorkflow.php deleted file mode 100644 index a56a5f88e7..0000000000 --- a/src/applications/differential/management/PhabricatorHunksManagementWorkflow.php +++ /dev/null @@ -1,4 +0,0 @@ -buildLimitClause($conn_r)); $modern_results = $table->loadAllFromArray($modern_data); - - // Now, load legacy hunks. - $table = new DifferentialLegacyHunk(); - $conn_r = $table->establishConnection('r'); - - $legacy_data = queryfx_all( - $conn_r, - 'SELECT * FROM %T %Q %Q %Q', - $table->getTableName(), - $this->buildWhereClause($conn_r), - $this->buildOrderClause($conn_r), - $this->buildLimitClause($conn_r)); - $legacy_results = $table->loadAllFromArray($legacy_data); - // Strip all the IDs off since they're not unique and nothing should be // using them. - return array_values(array_merge($legacy_results, $modern_results)); + return array_values($modern_results); } protected function willFilterPage(array $hunks) { diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php index 4d7b9f5698..57f9d295b6 100644 --- a/src/applications/differential/storage/DifferentialChangeset.php +++ b/src/applications/differential/storage/DifferentialChangeset.php @@ -98,13 +98,6 @@ final class DifferentialChangeset extends DifferentialDAO public function delete() { $this->openTransaction(); - $legacy_hunks = id(new DifferentialLegacyHunk())->loadAllWhere( - 'changesetID = %d', - $this->getID()); - foreach ($legacy_hunks as $legacy_hunk) { - $legacy_hunk->delete(); - } - $modern_hunks = id(new DifferentialModernHunk())->loadAllWhere( 'changesetID = %d', $this->getID()); From 77fa1ea73835f2c8db5b71c9fd3583cfe2f1fb01 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 10:14:26 -0800 Subject: [PATCH 23/78] Rename "DifferentialReviewer" to "DifferentialReviewerProxy" Summary: Ref T10967. This makes room for a `DifferentialReviewer` object which can be a real storage table. Test Plan: Grepped for `DifferentialReviewer`, browsed Differential. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10967 Differential Revision: https://secure.phabricator.com/D17041 --- src/__phutil_library_map__.php | 4 ++-- .../controller/DifferentialCommentSaveController.php | 2 +- .../differential/customfield/DifferentialReviewersField.php | 2 +- .../differential/editor/DifferentialTransactionEditor.php | 2 +- .../differential/query/DifferentialRevisionQuery.php | 4 +++- ...DifferentialReviewer.php => DifferentialReviewerProxy.php} | 2 +- .../differential/storage/DifferentialRevision.php | 2 +- .../differential/view/DifferentialReviewersView.php | 2 +- 8 files changed, 11 insertions(+), 9 deletions(-) rename src/applications/differential/storage/{DifferentialReviewer.php => DifferentialReviewerProxy.php} (96%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 976ccaed3c..00f67fbe29 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -495,9 +495,9 @@ phutil_register_library_map(array( 'DifferentialResponsibleViewerFunctionDatasource' => 'applications/differential/typeahead/DifferentialResponsibleViewerFunctionDatasource.php', 'DifferentialRevertPlanField' => 'applications/differential/customfield/DifferentialRevertPlanField.php', 'DifferentialReviewedByField' => 'applications/differential/customfield/DifferentialReviewedByField.php', - 'DifferentialReviewer' => 'applications/differential/storage/DifferentialReviewer.php', 'DifferentialReviewerDatasource' => 'applications/differential/typeahead/DifferentialReviewerDatasource.php', 'DifferentialReviewerForRevisionEdgeType' => 'applications/differential/edge/DifferentialReviewerForRevisionEdgeType.php', + 'DifferentialReviewerProxy' => 'applications/differential/storage/DifferentialReviewerProxy.php', 'DifferentialReviewerStatus' => 'applications/differential/constants/DifferentialReviewerStatus.php', 'DifferentialReviewersAddBlockingReviewersHeraldAction' => 'applications/differential/herald/DifferentialReviewersAddBlockingReviewersHeraldAction.php', 'DifferentialReviewersAddBlockingSelfHeraldAction' => 'applications/differential/herald/DifferentialReviewersAddBlockingSelfHeraldAction.php', @@ -5125,9 +5125,9 @@ phutil_register_library_map(array( 'DifferentialResponsibleViewerFunctionDatasource' => 'PhabricatorTypeaheadDatasource', 'DifferentialRevertPlanField' => 'DifferentialStoredCustomField', 'DifferentialReviewedByField' => 'DifferentialCoreCustomField', - 'DifferentialReviewer' => 'Phobject', 'DifferentialReviewerDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DifferentialReviewerForRevisionEdgeType' => 'PhabricatorEdgeType', + 'DifferentialReviewerProxy' => 'Phobject', 'DifferentialReviewerStatus' => 'Phobject', 'DifferentialReviewersAddBlockingReviewersHeraldAction' => 'DifferentialReviewersHeraldAction', 'DifferentialReviewersAddBlockingSelfHeraldAction' => 'DifferentialReviewersHeraldAction', diff --git a/src/applications/differential/controller/DifferentialCommentSaveController.php b/src/applications/differential/controller/DifferentialCommentSaveController.php index 831d7c90c8..87376bf6d5 100644 --- a/src/applications/differential/controller/DifferentialCommentSaveController.php +++ b/src/applications/differential/controller/DifferentialCommentSaveController.php @@ -64,7 +64,7 @@ final class DifferentialCommentSaveController if (isset($current_reviewers[$reviewer_phid])) { continue; } - $reviewer = new DifferentialReviewer( + $reviewer = new DifferentialReviewerProxy( $reviewer_phid, array( 'status' => DifferentialReviewerStatus::STATUS_ADDED, diff --git a/src/applications/differential/customfield/DifferentialReviewersField.php b/src/applications/differential/customfield/DifferentialReviewersField.php index 41a4cf8f26..5138733c41 100644 --- a/src/applications/differential/customfield/DifferentialReviewersField.php +++ b/src/applications/differential/customfield/DifferentialReviewersField.php @@ -84,7 +84,7 @@ final class DifferentialReviewersField } foreach ($new_reviewers as $phid => $status) { - $new_reviewers[$phid] = new DifferentialReviewer( + $new_reviewers[$phid] = new DifferentialReviewerProxy( $phid, array( 'status' => $status, diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index b4828494c0..f1bed835d9 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -474,7 +474,7 @@ final class DifferentialTransactionEditor $owner_phid = $object->getAuthorPHID(); if ($owner_phid) { - $reviewer = new DifferentialReviewer( + $reviewer = new DifferentialReviewerProxy( $owner_phid, array( 'status' => DifferentialReviewerStatus::STATUS_ADDED, diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php index f36a686eb5..6dd690d179 100644 --- a/src/applications/differential/query/DifferentialRevisionQuery.php +++ b/src/applications/differential/query/DifferentialRevisionQuery.php @@ -1008,7 +1008,9 @@ final class DifferentialRevisionQuery $revision_edges = $edges[$revision->getPHID()][$edge_type]; $reviewers = array(); foreach ($revision_edges as $reviewer_phid => $edge) { - $reviewer = new DifferentialReviewer($reviewer_phid, $edge['data']); + $reviewer = new DifferentialReviewerProxy( + $reviewer_phid, + $edge['data']); if ($this->needReviewerAuthority) { if (!$viewer_phid) { diff --git a/src/applications/differential/storage/DifferentialReviewer.php b/src/applications/differential/storage/DifferentialReviewerProxy.php similarity index 96% rename from src/applications/differential/storage/DifferentialReviewer.php rename to src/applications/differential/storage/DifferentialReviewerProxy.php index 1ad7fbc8b0..bf38ee27e3 100644 --- a/src/applications/differential/storage/DifferentialReviewer.php +++ b/src/applications/differential/storage/DifferentialReviewerProxy.php @@ -1,6 +1,6 @@ reviewerStatus = $reviewers; return $this; diff --git a/src/applications/differential/view/DifferentialReviewersView.php b/src/applications/differential/view/DifferentialReviewersView.php index b94e246d73..fd558d85f1 100644 --- a/src/applications/differential/view/DifferentialReviewersView.php +++ b/src/applications/differential/view/DifferentialReviewersView.php @@ -7,7 +7,7 @@ final class DifferentialReviewersView extends AphrontView { private $diff; public function setReviewers(array $reviewers) { - assert_instances_of($reviewers, 'DifferentialReviewer'); + assert_instances_of($reviewers, 'DifferentialReviewerProxy'); $this->reviewers = $reviewers; return $this; } From eda64b85497b82782a24ffe8e0f276e4423d3c46 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 12:11:17 -0800 Subject: [PATCH 24/78] Add a very basic EditPro controller for Differential Summary: Ref T11114. This doesn't really support anything yet, but technically works if you manually go to `/editpro/`. Test Plan: {F2117302} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17043 --- src/__phutil_library_map__.php | 4 ++ .../PhabricatorDifferentialApplication.php | 2 + .../DifferentialRevisionEditProController.php | 12 ++++ .../editor/DifferentialRevisionEditEngine.php | 66 +++++++++++++++++++ ...bricatorCustomFieldEditEngineExtension.php | 6 ++ 5 files changed, 90 insertions(+) create mode 100644 src/applications/differential/controller/DifferentialRevisionEditProController.php create mode 100644 src/applications/differential/editor/DifferentialRevisionEditEngine.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 00f67fbe29..39624fb9ab 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -518,6 +518,8 @@ phutil_register_library_map(array( 'DifferentialRevisionDependedOnByRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependedOnByRevisionEdgeType.php', 'DifferentialRevisionDependsOnRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependsOnRevisionEdgeType.php', 'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php', + 'DifferentialRevisionEditEngine' => 'applications/differential/editor/DifferentialRevisionEditEngine.php', + 'DifferentialRevisionEditProController' => 'applications/differential/controller/DifferentialRevisionEditProController.php', 'DifferentialRevisionFulltextEngine' => 'applications/differential/search/DifferentialRevisionFulltextEngine.php', 'DifferentialRevisionGraph' => 'infrastructure/graph/DifferentialRevisionGraph.php', 'DifferentialRevisionHasChildRelationship' => 'applications/differential/relationships/DifferentialRevisionHasChildRelationship.php', @@ -5164,6 +5166,8 @@ phutil_register_library_map(array( 'DifferentialRevisionDependedOnByRevisionEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionDependsOnRevisionEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionEditController' => 'DifferentialController', + 'DifferentialRevisionEditEngine' => 'PhabricatorEditEngine', + 'DifferentialRevisionEditProController' => 'DifferentialController', 'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine', 'DifferentialRevisionGraph' => 'PhabricatorObjectGraph', 'DifferentialRevisionHasChildRelationship' => 'DifferentialRevisionRelationship', diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php index 589dfe239d..d72fd2ddc8 100644 --- a/src/applications/differential/application/PhabricatorDifferentialApplication.php +++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php @@ -67,6 +67,8 @@ final class PhabricatorDifferentialApplication extends PhabricatorApplication { 'revision/' => array( 'edit/(?:(?P[1-9]\d*)/)?' => 'DifferentialRevisionEditController', + $this->getEditRoutePattern('editpro/') + => 'DifferentialRevisionEditProController', 'land/(?:(?P[1-9]\d*))/(?P[^/]+)/' => 'DifferentialRevisionLandController', 'closedetails/(?P[^/]+)/' diff --git a/src/applications/differential/controller/DifferentialRevisionEditProController.php b/src/applications/differential/controller/DifferentialRevisionEditProController.php new file mode 100644 index 0000000000..9c1257dac9 --- /dev/null +++ b/src/applications/differential/controller/DifferentialRevisionEditProController.php @@ -0,0 +1,12 @@ +setController($this) + ->buildResponse(); + } + +} diff --git a/src/applications/differential/editor/DifferentialRevisionEditEngine.php b/src/applications/differential/editor/DifferentialRevisionEditEngine.php new file mode 100644 index 0000000000..8953dc4242 --- /dev/null +++ b/src/applications/differential/editor/DifferentialRevisionEditEngine.php @@ -0,0 +1,66 @@ +getViewer(); + return DifferentialRevision::initializeNewRevision($viewer); + } + + protected function newObjectQuery() { + return new DifferentialRevisionQuery(); + } + + protected function getObjectCreateTitleText($object) { + return pht('Create New Revision'); + } + + protected function getObjectEditTitleText($object) { + return pht('Edit Revision: %s', $object->getTitle()); + } + + protected function getObjectEditShortText($object) { + return $object->getMonogram(); + } + + protected function getObjectCreateShortText() { + return pht('Create Revision'); + } + + protected function getObjectName() { + return pht('Revision'); + } + + protected function getObjectViewURI($object) { + return $object->getURI(); + } + + protected function buildCustomEditFields($object) { + return array(); + } + +} diff --git a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php index b9427905b8..b38eb2961f 100644 --- a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php +++ b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php @@ -27,6 +27,12 @@ final class PhabricatorCustomFieldEditEngineExtension PhabricatorEditEngine $engine, PhabricatorApplicationTransactionInterface $object) { + // TODO: Remove this hack once Differential modernizes more fully. Today, + // its custom fields are too custom to interact cleanly with EditEngine. + if ($object instanceof DifferentialRevision) { + return array(); + } + $viewer = $this->getViewer(); $field_list = PhabricatorCustomField::getObjectFields( From 0906bf547b9a065ff8b4a75968aaacdce97ab5f1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 13:03:32 -0800 Subject: [PATCH 25/78] Begin adding "pro" modular transaction fields to Differential Summary: Ref T11114. Currently, all of Differential is extremely custom CustomFields. I want to back away from that somewhat and leverage more EditEngine / ModularTransactions infrastructure. This allows EditEngine, ModularTransactions, and CustomFields to coexist in an uneasy peace. The "EditPro" controller applies a //different edit// than the CustomFields do, but everything works out in the end. I think. Hopefully the horrible mess I am creating here will be short-lived. Test Plan: - Edited a revision with the normal editor. - Edited a revision with the pro editor. - Created a revision with `arc diff`. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17044 --- src/__phutil_library_map__.php | 6 +- .../editor/DifferentialRevisionEditEngine.php | 12 +++- .../storage/DifferentialTransaction.php | 6 +- .../DifferentialRevisionTitleTransaction.php | 57 +++++++++++++++++++ .../DifferentialRevisionTransactionType.php | 4 ++ .../storage/PhabricatorModularTransaction.php | 14 +++-- 6 files changed, 91 insertions(+), 8 deletions(-) create mode 100644 src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php create mode 100644 src/applications/differential/xaction/DifferentialRevisionTransactionType.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 39624fb9ab..eae5e70b65 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -553,6 +553,8 @@ phutil_register_library_map(array( 'DifferentialRevisionStatus' => 'applications/differential/constants/DifferentialRevisionStatus.php', 'DifferentialRevisionSummaryHeraldField' => 'applications/differential/herald/DifferentialRevisionSummaryHeraldField.php', 'DifferentialRevisionTitleHeraldField' => 'applications/differential/herald/DifferentialRevisionTitleHeraldField.php', + 'DifferentialRevisionTitleTransaction' => 'applications/differential/xaction/DifferentialRevisionTitleTransaction.php', + 'DifferentialRevisionTransactionType' => 'applications/differential/xaction/DifferentialRevisionTransactionType.php', 'DifferentialRevisionUpdateHistoryView' => 'applications/differential/view/DifferentialRevisionUpdateHistoryView.php', 'DifferentialRevisionViewController' => 'applications/differential/controller/DifferentialRevisionViewController.php', 'DifferentialSchemaSpec' => 'applications/differential/storage/DifferentialSchemaSpec.php', @@ -5201,6 +5203,8 @@ phutil_register_library_map(array( 'DifferentialRevisionStatus' => 'Phobject', 'DifferentialRevisionSummaryHeraldField' => 'DifferentialRevisionHeraldField', 'DifferentialRevisionTitleHeraldField' => 'DifferentialRevisionHeraldField', + 'DifferentialRevisionTitleTransaction' => 'DifferentialRevisionTransactionType', + 'DifferentialRevisionTransactionType' => 'PhabricatorModularTransactionType', 'DifferentialRevisionUpdateHistoryView' => 'AphrontView', 'DifferentialRevisionViewController' => 'DifferentialController', 'DifferentialSchemaSpec' => 'PhabricatorConfigSchemaSpec', @@ -5210,7 +5214,7 @@ phutil_register_library_map(array( 'DifferentialSummaryField' => 'DifferentialCoreCustomField', 'DifferentialTestPlanField' => 'DifferentialCoreCustomField', 'DifferentialTitleField' => 'DifferentialCoreCustomField', - 'DifferentialTransaction' => 'PhabricatorApplicationTransaction', + 'DifferentialTransaction' => 'PhabricatorModularTransaction', 'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment', 'DifferentialTransactionEditor' => 'PhabricatorApplicationTransactionEditor', 'DifferentialTransactionQuery' => 'PhabricatorApplicationTransactionQuery', diff --git a/src/applications/differential/editor/DifferentialRevisionEditEngine.php b/src/applications/differential/editor/DifferentialRevisionEditEngine.php index 8953dc4242..9bd986c33d 100644 --- a/src/applications/differential/editor/DifferentialRevisionEditEngine.php +++ b/src/applications/differential/editor/DifferentialRevisionEditEngine.php @@ -60,7 +60,17 @@ final class DifferentialRevisionEditEngine } protected function buildCustomEditFields($object) { - return array(); + return array( + id(new PhabricatorTextEditField()) + ->setKey('title') + ->setLabel(pht('Title')) + ->setTransactionType( + DifferentialRevisionTitleTransaction::TRANSACTIONTYPE) + ->setDescription(pht('The title of the revision.')) + ->setConduitDescription(pht('Retitle the revision.')) + ->setConduitTypeDescription(pht('New revision title.')) + ->setValue($object->getTitle()), + ); } } diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index bc52227590..0c9e0589eb 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -1,6 +1,7 @@ isCommandeerSideEffect = $is_side_effect; diff --git a/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php b/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php new file mode 100644 index 0000000000..d5f529f47b --- /dev/null +++ b/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php @@ -0,0 +1,57 @@ +getTitle(); + } + + public function applyInternalEffects($object, $value) { + $object->setTitle($value); + } + + public function getTitle() { + return pht( + '%s retitled this revision from %s to %s.', + $this->renderAuthor(), + $this->renderOldValue(), + $this->renderNewValue()); + } + + public function getTitleForFeed() { + return pht( + '%s retitled %s from %s to %s.', + $this->renderAuthor(), + $this->renderObject(), + $this->renderOldValue(), + $this->renderNewValue()); + } + + public function validateTransactions($object, array $xactions) { + $errors = array(); + + if ($this->isEmptyTextTransaction($object->getTitle(), $xactions)) { + $errors[] = $this->newRequiredError( + pht('Revisions must have a title.')); + } + + $max_length = $object->getColumnMaximumByteLength('title'); + foreach ($xactions as $xaction) { + $new_value = $xaction->getNewValue(); + $new_length = strlen($new_value); + if ($new_length > $max_length) { + $errors[] = $this->newInvalidError( + pht( + 'Revision title is too long: the maximum length of a '. + 'revision title is 255 bytes.'), + $xaction); + } + } + + return $errors; + } + +} diff --git a/src/applications/differential/xaction/DifferentialRevisionTransactionType.php b/src/applications/differential/xaction/DifferentialRevisionTransactionType.php new file mode 100644 index 0000000000..f740d97c74 --- /dev/null +++ b/src/applications/differential/xaction/DifferentialRevisionTransactionType.php @@ -0,0 +1,4 @@ +applyExternalEffects($object); } - final public function shouldHide() { + /* final */ public function shouldHide() { if ($this->getTransactionImplementation()->shouldHide()) { return true; } @@ -84,7 +88,7 @@ abstract class PhabricatorModularTransaction return parent::shouldHide(); } - final public function getIcon() { + /* final */ public function getIcon() { $icon = $this->getTransactionImplementation()->getIcon(); if ($icon !== null) { return $icon; @@ -93,7 +97,7 @@ abstract class PhabricatorModularTransaction return parent::getIcon(); } - final public function getTitle() { + /* final */ public function getTitle() { $title = $this->getTransactionImplementation()->getTitle(); if ($title !== null) { return $title; @@ -111,7 +115,7 @@ abstract class PhabricatorModularTransaction return $title; } - final public function getTitleForFeed() { + /* final */ public function getTitleForFeed() { $title = $this->getTransactionImplementation()->getTitleForFeed(); if ($title !== null) { return $title; @@ -120,7 +124,7 @@ abstract class PhabricatorModularTransaction return parent::getTitleForFeed(); } - final public function getColor() { + /* final */ public function getColor() { $color = $this->getTransactionImplementation()->getColor(); if ($color !== null) { return $color; From 5349d6bd5c097e9645250bb0bdea1a870f3f9328 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 15:01:52 -0800 Subject: [PATCH 26/78] Add Summary and Repository EditEngine fields + Modular Transactions to Differential Summary: Ref T11114. These are unambiguous and always-enabled. Test Plan: {F2117777} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17047 --- src/__phutil_library_map__.php | 4 + .../editor/DifferentialRevisionEditEngine.php | 20 ++++ ...ferentialRevisionRepositoryTransaction.php | 95 +++++++++++++++++++ ...DifferentialRevisionSummaryTransaction.php | 56 +++++++++++ 4 files changed, 175 insertions(+) create mode 100644 src/applications/differential/xaction/DifferentialRevisionRepositoryTransaction.php create mode 100644 src/applications/differential/xaction/DifferentialRevisionSummaryTransaction.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index eae5e70b65..842b76a8ea 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -545,6 +545,7 @@ phutil_register_library_map(array( 'DifferentialRevisionRelationshipSource' => 'applications/search/relationship/DifferentialRevisionRelationshipSource.php', 'DifferentialRevisionRepositoryHeraldField' => 'applications/differential/herald/DifferentialRevisionRepositoryHeraldField.php', 'DifferentialRevisionRepositoryProjectsHeraldField' => 'applications/differential/herald/DifferentialRevisionRepositoryProjectsHeraldField.php', + 'DifferentialRevisionRepositoryTransaction' => 'applications/differential/xaction/DifferentialRevisionRepositoryTransaction.php', 'DifferentialRevisionRequiredActionResultBucket' => 'applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php', 'DifferentialRevisionResultBucket' => 'applications/differential/query/DifferentialRevisionResultBucket.php', 'DifferentialRevisionReviewersHeraldField' => 'applications/differential/herald/DifferentialRevisionReviewersHeraldField.php', @@ -552,6 +553,7 @@ phutil_register_library_map(array( 'DifferentialRevisionSearchEngine' => 'applications/differential/query/DifferentialRevisionSearchEngine.php', 'DifferentialRevisionStatus' => 'applications/differential/constants/DifferentialRevisionStatus.php', 'DifferentialRevisionSummaryHeraldField' => 'applications/differential/herald/DifferentialRevisionSummaryHeraldField.php', + 'DifferentialRevisionSummaryTransaction' => 'applications/differential/xaction/DifferentialRevisionSummaryTransaction.php', 'DifferentialRevisionTitleHeraldField' => 'applications/differential/herald/DifferentialRevisionTitleHeraldField.php', 'DifferentialRevisionTitleTransaction' => 'applications/differential/xaction/DifferentialRevisionTitleTransaction.php', 'DifferentialRevisionTransactionType' => 'applications/differential/xaction/DifferentialRevisionTransactionType.php', @@ -5195,6 +5197,7 @@ phutil_register_library_map(array( 'DifferentialRevisionRelationshipSource' => 'PhabricatorObjectRelationshipSource', 'DifferentialRevisionRepositoryHeraldField' => 'DifferentialRevisionHeraldField', 'DifferentialRevisionRepositoryProjectsHeraldField' => 'DifferentialRevisionHeraldField', + 'DifferentialRevisionRepositoryTransaction' => 'DifferentialRevisionTransactionType', 'DifferentialRevisionRequiredActionResultBucket' => 'DifferentialRevisionResultBucket', 'DifferentialRevisionResultBucket' => 'PhabricatorSearchResultBucket', 'DifferentialRevisionReviewersHeraldField' => 'DifferentialRevisionHeraldField', @@ -5202,6 +5205,7 @@ phutil_register_library_map(array( 'DifferentialRevisionSearchEngine' => 'PhabricatorApplicationSearchEngine', 'DifferentialRevisionStatus' => 'Phobject', 'DifferentialRevisionSummaryHeraldField' => 'DifferentialRevisionHeraldField', + 'DifferentialRevisionSummaryTransaction' => 'DifferentialRevisionTransactionType', 'DifferentialRevisionTitleHeraldField' => 'DifferentialRevisionHeraldField', 'DifferentialRevisionTitleTransaction' => 'DifferentialRevisionTransactionType', 'DifferentialRevisionTransactionType' => 'PhabricatorModularTransactionType', diff --git a/src/applications/differential/editor/DifferentialRevisionEditEngine.php b/src/applications/differential/editor/DifferentialRevisionEditEngine.php index 9bd986c33d..c9627a50b0 100644 --- a/src/applications/differential/editor/DifferentialRevisionEditEngine.php +++ b/src/applications/differential/editor/DifferentialRevisionEditEngine.php @@ -64,12 +64,32 @@ final class DifferentialRevisionEditEngine id(new PhabricatorTextEditField()) ->setKey('title') ->setLabel(pht('Title')) + ->setIsRequired(true) ->setTransactionType( DifferentialRevisionTitleTransaction::TRANSACTIONTYPE) ->setDescription(pht('The title of the revision.')) ->setConduitDescription(pht('Retitle the revision.')) ->setConduitTypeDescription(pht('New revision title.')) ->setValue($object->getTitle()), + id(new PhabricatorRemarkupEditField()) + ->setKey('summary') + ->setLabel(pht('Summary')) + ->setTransactionType( + DifferentialRevisionSummaryTransaction::TRANSACTIONTYPE) + ->setDescription(pht('The summary of the revision.')) + ->setConduitDescription(pht('Change the revision summary.')) + ->setConduitTypeDescription(pht('New revision summary.')) + ->setValue($object->getSummary()), + id(new PhabricatorDatasourceEditField()) + ->setKey('repositoryPHID') + ->setLabel(pht('Repository')) + ->setDatasource(new DiffusionRepositoryDatasource()) + ->setTransactionType( + DifferentialRevisionRepositoryTransaction::TRANSACTIONTYPE) + ->setDescription(pht('The repository the revision belongs to.')) + ->setConduitDescription(pht('Change the repository for this revision.')) + ->setConduitTypeDescription(pht('New repository.')) + ->setSingleValue($object->getRepositoryPHID()), ); } diff --git a/src/applications/differential/xaction/DifferentialRevisionRepositoryTransaction.php b/src/applications/differential/xaction/DifferentialRevisionRepositoryTransaction.php new file mode 100644 index 0000000000..63c7f2c32d --- /dev/null +++ b/src/applications/differential/xaction/DifferentialRevisionRepositoryTransaction.php @@ -0,0 +1,95 @@ +getRepositoryPHID(); + } + + public function applyInternalEffects($object, $value) { + $object->setRepositoryPHID($value); + } + + public function getTitle() { + $old = $this->getOldValue(); + $new = $this->getNewValue(); + if ($old && $new) { + return pht( + '%s changed the repository for this revision from %s to %s.', + $this->renderAuthor(), + $this->renderHandle($old), + $this->renderHandle($new)); + } else if ($new) { + return pht( + '%s set the repository for this revision to %s.', + $this->renderAuthor(), + $this->renderHandle($new)); + } else { + return pht( + '%s removed %s as the repository for this revision.', + $this->renderAuthor(), + $this->renderHandle($old)); + } + } + + public function getTitleForFeed() { + $old = $this->getOldValue(); + $new = $this->getNewValue(); + if ($old && $new) { + return pht( + '%s changed the repository for %s from %s to %s.', + $this->renderAuthor(), + $this->renderObject(), + $this->renderHandle($old), + $this->renderHandle($new)); + } else if ($new) { + return pht( + '%s set the repository for %s to %s.', + $this->renderAuthor(), + $this->renderObject(), + $this->renderHandle($new)); + } else { + return pht( + '%s removed %s as the repository for %s.', + $this->renderAuthor(), + $this->renderHandle($old), + $this->renderObject()); + } + } + + public function validateTransactions($object, array $xactions) { + $actor = $this->getActor(); + + $errors = array(); + + $old_value = $object->getRepositoryPHID(); + foreach ($xactions as $xaction) { + $new_value = $xaction->getNewValue(); + if (!$new_value) { + continue; + } + + if ($new_value == $old_value) { + continue; + } + + $repository = id(new PhabricatorRepositoryQuery()) + ->setViewer($actor) + ->withPHIDs(array($new_value)) + ->executeOne(); + if (!$repository) { + $errors[] = $this->newInvalidError( + pht( + 'Repository "%s" is not a valid repository, or you do not have '. + 'permission to view it.'), + $xaction); + } + } + + return $errors; + } + +} diff --git a/src/applications/differential/xaction/DifferentialRevisionSummaryTransaction.php b/src/applications/differential/xaction/DifferentialRevisionSummaryTransaction.php new file mode 100644 index 0000000000..0ad6ba0971 --- /dev/null +++ b/src/applications/differential/xaction/DifferentialRevisionSummaryTransaction.php @@ -0,0 +1,56 @@ +getSummary(); + } + + public function applyInternalEffects($object, $value) { + $object->setSummary($value); + } + + public function getTitle() { + return pht( + '%s edited the summary of this revision.', + $this->renderAuthor()); + } + + public function getTitleForFeed() { + return pht( + '%s updated the summary of %s.', + $this->renderAuthor(), + $this->renderObject()); + } + + public function hasChangeDetailView() { + return true; + } + + public function getMailDiffSectionHeader() { + return pht('CHANGES TO REVISION SUMMARY'); + } + + public function newChangeDetailView() { + $viewer = $this->getViewer(); + + return id(new PhabricatorApplicationTransactionTextDiffDetailView()) + ->setViewer($viewer) + ->setOldText($this->getOldValue()) + ->setNewText($this->getNewValue()); + } + + public function newRemarkupChanges() { + $changes = array(); + + $changes[] = $this->newRemarkupChange() + ->setOldValue($this->getOldValue()) + ->setNewValue($this->getNewValue()); + + return $changes; + } + +} From 6c9af81f7adbcb0fc191ad8d5fe9eee9906b8cd9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 15:24:55 -0800 Subject: [PATCH 27/78] Support "Test Plan" with modular transactions and EditEngine Summary: Ref T11114. The only real trick here is that we respect configuration in `differential.fields`. Test Plan: Turned plan on and off, tried to remove the plan, edited the plan. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17048 --- src/__phutil_library_map__.php | 2 + .../editor/DifferentialRevisionEditEngine.php | 93 +++++++++++++------ ...ifferentialRevisionTestPlanTransaction.php | 74 +++++++++++++++ 3 files changed, 139 insertions(+), 30 deletions(-) create mode 100644 src/applications/differential/xaction/DifferentialRevisionTestPlanTransaction.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 842b76a8ea..2d16296526 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -554,6 +554,7 @@ phutil_register_library_map(array( 'DifferentialRevisionStatus' => 'applications/differential/constants/DifferentialRevisionStatus.php', 'DifferentialRevisionSummaryHeraldField' => 'applications/differential/herald/DifferentialRevisionSummaryHeraldField.php', 'DifferentialRevisionSummaryTransaction' => 'applications/differential/xaction/DifferentialRevisionSummaryTransaction.php', + 'DifferentialRevisionTestPlanTransaction' => 'applications/differential/xaction/DifferentialRevisionTestPlanTransaction.php', 'DifferentialRevisionTitleHeraldField' => 'applications/differential/herald/DifferentialRevisionTitleHeraldField.php', 'DifferentialRevisionTitleTransaction' => 'applications/differential/xaction/DifferentialRevisionTitleTransaction.php', 'DifferentialRevisionTransactionType' => 'applications/differential/xaction/DifferentialRevisionTransactionType.php', @@ -5206,6 +5207,7 @@ phutil_register_library_map(array( 'DifferentialRevisionStatus' => 'Phobject', 'DifferentialRevisionSummaryHeraldField' => 'DifferentialRevisionHeraldField', 'DifferentialRevisionSummaryTransaction' => 'DifferentialRevisionTransactionType', + 'DifferentialRevisionTestPlanTransaction' => 'DifferentialRevisionTransactionType', 'DifferentialRevisionTitleHeraldField' => 'DifferentialRevisionHeraldField', 'DifferentialRevisionTitleTransaction' => 'DifferentialRevisionTransactionType', 'DifferentialRevisionTransactionType' => 'PhabricatorModularTransactionType', diff --git a/src/applications/differential/editor/DifferentialRevisionEditEngine.php b/src/applications/differential/editor/DifferentialRevisionEditEngine.php index c9627a50b0..6a3ad0703b 100644 --- a/src/applications/differential/editor/DifferentialRevisionEditEngine.php +++ b/src/applications/differential/editor/DifferentialRevisionEditEngine.php @@ -60,37 +60,70 @@ final class DifferentialRevisionEditEngine } protected function buildCustomEditFields($object) { - return array( - id(new PhabricatorTextEditField()) - ->setKey('title') - ->setLabel(pht('Title')) - ->setIsRequired(true) + + $plan_required = PhabricatorEnv::getEnvConfig( + 'differential.require-test-plan-field'); + $plan_enabled = $this->isCustomFieldEnabled( + $object, + 'differential:test-plan'); + + $fields = array(); + $fields[] = id(new PhabricatorTextEditField()) + ->setKey('title') + ->setLabel(pht('Title')) + ->setIsRequired(true) + ->setTransactionType( + DifferentialRevisionTitleTransaction::TRANSACTIONTYPE) + ->setDescription(pht('The title of the revision.')) + ->setConduitDescription(pht('Retitle the revision.')) + ->setConduitTypeDescription(pht('New revision title.')) + ->setValue($object->getTitle()); + + $fields[] = id(new PhabricatorRemarkupEditField()) + ->setKey('summary') + ->setLabel(pht('Summary')) + ->setTransactionType( + DifferentialRevisionSummaryTransaction::TRANSACTIONTYPE) + ->setDescription(pht('The summary of the revision.')) + ->setConduitDescription(pht('Change the revision summary.')) + ->setConduitTypeDescription(pht('New revision summary.')) + ->setValue($object->getSummary()); + + if ($plan_enabled) { + $fields[] = id(new PhabricatorRemarkupEditField()) + ->setKey('testPlan') + ->setLabel(pht('Test Plan')) + ->setIsRequired($plan_required) ->setTransactionType( - DifferentialRevisionTitleTransaction::TRANSACTIONTYPE) - ->setDescription(pht('The title of the revision.')) - ->setConduitDescription(pht('Retitle the revision.')) - ->setConduitTypeDescription(pht('New revision title.')) - ->setValue($object->getTitle()), - id(new PhabricatorRemarkupEditField()) - ->setKey('summary') - ->setLabel(pht('Summary')) - ->setTransactionType( - DifferentialRevisionSummaryTransaction::TRANSACTIONTYPE) - ->setDescription(pht('The summary of the revision.')) - ->setConduitDescription(pht('Change the revision summary.')) - ->setConduitTypeDescription(pht('New revision summary.')) - ->setValue($object->getSummary()), - id(new PhabricatorDatasourceEditField()) - ->setKey('repositoryPHID') - ->setLabel(pht('Repository')) - ->setDatasource(new DiffusionRepositoryDatasource()) - ->setTransactionType( - DifferentialRevisionRepositoryTransaction::TRANSACTIONTYPE) - ->setDescription(pht('The repository the revision belongs to.')) - ->setConduitDescription(pht('Change the repository for this revision.')) - ->setConduitTypeDescription(pht('New repository.')) - ->setSingleValue($object->getRepositoryPHID()), - ); + DifferentialRevisionTestPlanTransaction::TRANSACTIONTYPE) + ->setDescription( + pht('Actions performed to verify the behavior of the change.')) + ->setConduitDescription(pht('Update the revision test plan.')) + ->setConduitTypeDescription(pht('New test plan.')) + ->setValue($object->getTestPlan()); + } + + $fields[] = id(new PhabricatorDatasourceEditField()) + ->setKey('repositoryPHID') + ->setLabel(pht('Repository')) + ->setDatasource(new DiffusionRepositoryDatasource()) + ->setTransactionType( + DifferentialRevisionRepositoryTransaction::TRANSACTIONTYPE) + ->setDescription(pht('The repository the revision belongs to.')) + ->setConduitDescription(pht('Change the repository for this revision.')) + ->setConduitTypeDescription(pht('New repository.')) + ->setSingleValue($object->getRepositoryPHID()); + + return $fields; + } + + private function isCustomFieldEnabled(DifferentialRevision $revision, $key) { + $field_list = PhabricatorCustomField::getObjectFields( + $revision, + PhabricatorCustomField::ROLE_EDIT); + + $fields = $field_list->getFields(); + return isset($fields[$key]); } } diff --git a/src/applications/differential/xaction/DifferentialRevisionTestPlanTransaction.php b/src/applications/differential/xaction/DifferentialRevisionTestPlanTransaction.php new file mode 100644 index 0000000000..20aef744e6 --- /dev/null +++ b/src/applications/differential/xaction/DifferentialRevisionTestPlanTransaction.php @@ -0,0 +1,74 @@ +getTestPlan(); + } + + public function applyInternalEffects($object, $value) { + $object->setTestPlan($value); + } + + public function getTitle() { + return pht( + '%s edited the test plan for this revision.', + $this->renderAuthor()); + } + + public function getTitleForFeed() { + return pht( + '%s updated the test plan for %s.', + $this->renderAuthor(), + $this->renderObject()); + } + + public function hasChangeDetailView() { + return true; + } + + public function getMailDiffSectionHeader() { + return pht('CHANGES TO TEST PLAN'); + } + + public function newChangeDetailView() { + $viewer = $this->getViewer(); + + return id(new PhabricatorApplicationTransactionTextDiffDetailView()) + ->setViewer($viewer) + ->setOldText($this->getOldValue()) + ->setNewText($this->getNewValue()); + } + + public function newRemarkupChanges() { + $changes = array(); + + $changes[] = $this->newRemarkupChange() + ->setOldValue($this->getOldValue()) + ->setNewValue($this->getNewValue()); + + return $changes; + } + + public function validateTransactions($object, array $xactions) { + $errors = array(); + + $is_required = PhabricatorEnv::getEnvConfig( + 'differential.require-test-plan-field'); + + if ($is_required) { + if ($this->isEmptyTextTransaction($object->getTestPlan(), $xactions)) { + $errors[] = $this->newRequiredError( + pht( + 'You must provide a test plan. Describe the actions you '. + 'performed to verify the behavior of this change.')); + } + } + + return $errors; + } + +} From 7f99f2cde83582e112bf9e32a03ac4cde854c0d1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 15:46:46 -0800 Subject: [PATCH 28/78] Add EditEngine + Modular Transactions for reviewers Summary: Ref T11114. This one is a bit more complex, but I think I covered everything. Test Plan: - Added reviewers. - Removed reviewers. - Made reviewers blocking. - Made reviewers nonblocking. - Tried to make the author a reviewer. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17050 --- src/__phutil_library_map__.php | 2 + .../editor/DifferentialRevisionEditEngine.php | 15 +- .../storage/DifferentialRevision.php | 18 + ...fferentialRevisionReviewersTransaction.php | 350 ++++++++++++++++++ .../PhabricatorModularTransactionType.php | 2 +- 5 files changed, 385 insertions(+), 2 deletions(-) create mode 100644 src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 2d16296526..a738c0ea81 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -549,6 +549,7 @@ phutil_register_library_map(array( 'DifferentialRevisionRequiredActionResultBucket' => 'applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php', 'DifferentialRevisionResultBucket' => 'applications/differential/query/DifferentialRevisionResultBucket.php', 'DifferentialRevisionReviewersHeraldField' => 'applications/differential/herald/DifferentialRevisionReviewersHeraldField.php', + 'DifferentialRevisionReviewersTransaction' => 'applications/differential/xaction/DifferentialRevisionReviewersTransaction.php', 'DifferentialRevisionSearchConduitAPIMethod' => 'applications/differential/conduit/DifferentialRevisionSearchConduitAPIMethod.php', 'DifferentialRevisionSearchEngine' => 'applications/differential/query/DifferentialRevisionSearchEngine.php', 'DifferentialRevisionStatus' => 'applications/differential/constants/DifferentialRevisionStatus.php', @@ -5202,6 +5203,7 @@ phutil_register_library_map(array( 'DifferentialRevisionRequiredActionResultBucket' => 'DifferentialRevisionResultBucket', 'DifferentialRevisionResultBucket' => 'PhabricatorSearchResultBucket', 'DifferentialRevisionReviewersHeraldField' => 'DifferentialRevisionHeraldField', + 'DifferentialRevisionReviewersTransaction' => 'DifferentialRevisionTransactionType', 'DifferentialRevisionSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 'DifferentialRevisionSearchEngine' => 'PhabricatorApplicationSearchEngine', 'DifferentialRevisionStatus' => 'Phobject', diff --git a/src/applications/differential/editor/DifferentialRevisionEditEngine.php b/src/applications/differential/editor/DifferentialRevisionEditEngine.php index 6a3ad0703b..1e096db3ad 100644 --- a/src/applications/differential/editor/DifferentialRevisionEditEngine.php +++ b/src/applications/differential/editor/DifferentialRevisionEditEngine.php @@ -32,7 +32,8 @@ final class DifferentialRevisionEditEngine } protected function newObjectQuery() { - return new DifferentialRevisionQuery(); + return id(new DifferentialRevisionQuery()) + ->needReviewerStatus(true); } protected function getObjectCreateTitleText($object) { @@ -103,6 +104,18 @@ final class DifferentialRevisionEditEngine ->setValue($object->getTestPlan()); } + $fields[] = id(new PhabricatorDatasourceEditField()) + ->setKey('reviewerPHIDs') + ->setLabel(pht('Reviewers')) + ->setDatasource(new DifferentialReviewerDatasource()) + ->setUseEdgeTransactions(true) + ->setTransactionType( + DifferentialRevisionReviewersTransaction::TRANSACTIONTYPE) + ->setDescription(pht('Reviewers for this revision.')) + ->setConduitDescription(pht('Change the reviewers for this revision.')) + ->setConduitTypeDescription(pht('New reviewers.')) + ->setValue($object->getReviewerPHIDsForEdit()); + $fields[] = id(new PhabricatorDatasourceEditField()) ->setKey('repositoryPHID') ->setLabel(pht('Repository')) diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index 29ac61505d..906d89eacc 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -409,6 +409,24 @@ final class DifferentialRevision extends DifferentialDAO return $this; } + public function getReviewerPHIDsForEdit() { + $reviewers = $this->getReviewerStatus(); + + $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; + + $value = array(); + foreach ($reviewers as $reviewer) { + $phid = $reviewer->getReviewerPHID(); + if ($reviewer->getStatus() == $status_blocking) { + $value[] = 'blocking('.$phid.')'; + } else { + $value[] = $phid; + } + } + + return $value; + } + public function getRepository() { return $this->assertAttached($this->repository); } diff --git a/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php b/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php new file mode 100644 index 0000000000..9d22db1735 --- /dev/null +++ b/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php @@ -0,0 +1,350 @@ +getReviewerStatus(); + $reviewers = mpull($reviewers, 'getStatus', 'getReviewerPHID'); + return $reviewers; + } + + public function generateNewValue($object, $value) { + $actor = $this->getActor(); + + $datasource = id(new DifferentialBlockingReviewerDatasource()) + ->setViewer($actor); + + $reviewers = $this->generateOldValue($object); + + // First, remove any reviewers we're getting rid of. + $rem = idx($value, '-', array()); + $rem = $datasource->evaluateTokens($rem); + foreach ($rem as $phid) { + unset($reviewers[$phid]); + } + + $add = idx($value, '+', array()); + $add = $datasource->evaluateTokens($add); + $add_map = array(); + foreach ($add as $spec) { + if (!is_array($spec)) { + $phid = $spec; + $status = DifferentialReviewerStatus::STATUS_ADDED; + } else { + $phid = $spec['phid']; + $status = $spec['type']; + } + + $add_map[$phid] = $status; + } + + $set = idx($value, '=', null); + if ($set !== null) { + $set = $datasource->evaluateTokens($set); + foreach ($set as $spec) { + if (!is_array($spec)) { + $phid = $spec; + $status = DifferentialReviewerStatus::STATUS_ADDED; + } else { + $phid = $spec['phid']; + $status = $spec['type']; + } + + $add_map[$phid] = $status; + } + + // We treat setting reviewers as though they were being added to an + // empty list, so we can share more code between pathways. + $reviewers = array(); + } + + $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; + foreach ($add_map as $phid => $new_status) { + $old_status = idx($reviewers, $phid); + + // If we have an old status and this didn't make the reviewer blocking + // or nonblocking, just retain the old status. This makes sure we don't + // throw away rejects, accepts, etc. + if ($old_status) { + $was_blocking = ($old_status == $status_blocking); + $now_blocking = ($new_status == $status_blocking); + + $is_block = ($now_blocking && !$was_blocking); + $is_unblock = (!$now_blocking && $was_blocking); + + if (!$is_block && !$is_unblock) { + continue; + } + } + + $reviewers[$phid] = $new_status; + } + + return $reviewers; + } + + public function applyExternalEffects($object, $value) { + $src_phid = $object->getPHID(); + + $old = $this->generateOldValue($object); + $new = $value; + $edge_type = DifferentialRevisionHasReviewerEdgeType::EDGECONST; + + $editor = new PhabricatorEdgeEditor(); + + $rem = array_diff_key($old, $new); + foreach ($rem as $dst_phid => $status) { + $editor->removeEdge($src_phid, $edge_type, $dst_phid); + } + + foreach ($new as $dst_phid => $status) { + $old_status = idx($old, $dst_phid); + if ($old_status === $status) { + continue; + } + + $data = array( + 'data' => array( + 'status' => $status, + + // TODO: This seemes like it's buggy before the Modular Transactions + // changes. Figure out what's going on here? We don't have a very + // clean way to get the active diff ID right now. + 'diffID' => null, + ), + ); + + $editor->addEdge($src_phid, $edge_type, $dst_phid, $data); + } + + $editor->save(); + } + + public function getTitle() { + return $this->renderReviewerEditTitle(false); + } + + public function getTitleForFeed() { + return $this->renderReviewerEditTitle(true); + } + + private function renderReviewerEditTitle($is_feed) { + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + $rem = array_diff_key($old, $new); + $add = array_diff_key($new, $old); + $rem_phids = array_keys($rem); + $add_phids = array_keys($add); + $total_count = count($rem) + count($add); + + $parts = array(); + + if ($rem && $add) { + if ($is_feed) { + $parts[] = pht( + '%s edited %s reviewer(s) for %s, added %s: %s; removed %s: %s.', + $this->renderAuthor(), + new PhutilNumber($total_count), + $this->renderObject(), + phutil_count($add_phids), + $this->renderHandleList($add_phids), + phutil_count($rem_phids), + $this->renderHandleList($rem_phids)); + } else { + $parts[] = pht( + '%s edited %s reviewer(s), added %s: %s; removed %s: %s.', + $this->renderAuthor(), + new PhutilNumber($total_count), + phutil_count($add_phids), + $this->renderHandleList($add_phids), + phutil_count($rem_phids), + $this->renderHandleList($rem_phids)); + } + } else if ($add) { + if ($is_feed) { + $parts[] = pht( + '%s added %s reviewer(s) for %s: %s.', + $this->renderAuthor(), + phutil_count($add_phids), + $this->renderObject(), + $this->renderHandleList($add_phids)); + } else { + $parts[] = pht( + '%s added %s reviewer(s): %s.', + $this->renderAuthor(), + phutil_count($add_phids), + $this->renderHandleList($add_phids)); + } + } else if ($rem) { + if ($is_feed) { + $parts[] = pht( + '%s removed %s reviewer(s) for %s: %s.', + $this->renderAuthor(), + phutil_count($rem_phids), + $this->renderObject(), + $this->renderHandleList($rem_phids)); + } else { + $parts[] = pht( + '%s removed %s reviewer(s): %s.', + $this->renderAuthor(), + phutil_count($rem_phids), + $this->renderHandleList($rem_phids)); + } + } + + $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; + $blocks = array(); + $unblocks = array(); + foreach ($new as $phid => $new_status) { + $old_status = idx($old, $phid); + if (!$old_status) { + continue; + } + + $was_blocking = ($old_status == $status_blocking); + $now_blocking = ($new_status == $status_blocking); + + $is_block = ($now_blocking && !$was_blocking); + $is_unblock = (!$now_blocking && $was_blocking); + + if ($is_block) { + $blocks[] = $phid; + } + if ($is_unblock) { + $unblocks[] = $phid; + } + } + + $total_count = count($blocks) + count($unblocks); + + if ($blocks && $unblocks) { + if ($is_feed) { + $parts[] = pht( + '%s changed %s blocking reviewer(s) for %s, added %s: %s; removed '. + '%s: %s.', + $this->renderAuthor(), + new PhutilNumber($total_count), + $this->renderObject(), + phutil_count($blocks), + $this->renderHandleList($blocks), + phutil_count($unblocks), + $this->renderHandleList($unblocks)); + } else { + $parts[] = pht( + '%s changed %s blocking reviewer(s), added %s: %s; removed %s: %s.', + $this->renderAuthor(), + new PhutilNumber($total_count), + phutil_count($blocks), + $this->renderHandleList($blocks), + phutil_count($unblocks), + $this->renderHandleList($unblocks)); + } + } else if ($blocks) { + if ($is_feed) { + $parts[] = pht( + '%s added %s blocking reviewer(s) for %s: %s.', + $this->renderAuthor(), + phutil_count($blocks), + $this->renderObject(), + $this->renderHandleList($blocks)); + } else { + $parts[] = pht( + '%s added %s blocking reviewer(s): %s.', + $this->renderAuthor(), + phutil_count($blocks), + $this->renderHandleList($blocks)); + } + } else if ($unblocks) { + if ($is_feed) { + $parts[] = pht( + '%s removed %s blocking reviewer(s) for %s: %s.', + $this->renderAuthor(), + phutil_count($unblocks), + $this->renderObject(), + $this->renderHandleList($unblocks)); + } else { + $parts[] = pht( + '%s removed %s blocking reviewer(s): %s.', + $this->renderAuthor(), + phutil_count($unblocks), + $this->renderHandleList($unblocks)); + } + } + + if ($this->isTextMode()) { + return implode(' ', $parts); + } else { + return phutil_implode_html(' ', $parts); + } + } + + public function validateTransactions($object, array $xactions) { + $actor = $this->getActor(); + $errors = array(); + + $author_phid = $object->getAuthorPHID(); + $config_self_accept_key = 'differential.allow-self-accept'; + $allow_self_accept = PhabricatorEnv::getEnvConfig($config_self_accept_key); + + $old = $this->generateOldValue($object); + foreach ($xactions as $xaction) { + $new = $this->generateNewValue($object, $xaction->getNewValue()); + + $add = array_diff_key($new, $old); + if (!$add) { + continue; + } + + $objects = id(new PhabricatorObjectQuery()) + ->setViewer($actor) + ->withPHIDs(array_keys($add)) + ->execute(); + $objects = mpull($objects, null, 'getPHID'); + + foreach ($add as $phid => $status) { + if (!isset($objects[$phid])) { + $errors[] = $this->newInvalidError( + pht( + 'Reviewer "%s" is not a valid object.', + $phid), + $xaction); + continue; + } + + switch (phid_get_type($phid)) { + case PhabricatorPeopleUserPHIDType::TYPECONST: + case PhabricatorOwnersPackagePHIDType::TYPECONST: + case PhabricatorProjectProjectPHIDType::TYPECONST: + break; + default: + $errors[] = $this->newInvalidError( + pht( + 'Reviewer "%s" must be a user, a package, or a project.', + $phid), + $xaction); + continue 2; + } + + // NOTE: This weird behavior around commandeering is a bit unorthodox, + // but this restriction is an unusual one. + + $is_self = ($phid === $author_phid); + if ($is_self && !$allow_self_accept) { + if (!$xaction->getIsCommandeerSideEffect()) { + $errors[] = $this->newInvalidError( + pht('The author of a revision can not be a reviewer.'), + $xaction); + continue; + } + } + } + } + + return $errors; + } + +} diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php index 84bc4a07ec..21cee01cda 100644 --- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php +++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php @@ -277,7 +277,7 @@ abstract class PhabricatorModularTransactionType return !strlen($value); } - private function isTextMode() { + protected function isTextMode() { $target = $this->getStorage()->getRenderingTarget(); return ($target == PhabricatorApplicationTransaction::TARGET_TEXT); } From 0c6e03d5aff9bafa55c81c1a9645461cf07aec86 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 17:45:34 -0800 Subject: [PATCH 29/78] Fix a ModularTransactions exception with custom fields that support change details Summary: We're throwing here when we actually want to return `null` so we make it into custom field handling code. See Conpherence. Test Plan: Found a failing task and re-executed it with `bin/worker execute --id `; after this change, it didn't fatal. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D17051 --- .../transactions/storage/PhabricatorModularTransactionType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php index 21cee01cda..2ae06131f4 100644 --- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php +++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php @@ -68,7 +68,7 @@ abstract class PhabricatorModularTransactionType } public function newChangeDetailView() { - throw new PhutilMethodNotImplementedException(); + return null; } public function getMailDiffSectionHeader() { From 5215eb3067912cfc3eaa83e7f094755a3dec6bde Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 14 Dec 2016 05:37:10 -0800 Subject: [PATCH 30/78] Fix an issue where unexpected debugging output would run afoul of automatic compression Summary: If you put "echo" or "print" statements into the code at random places (as I frequently do during development), they would emit before we enabled compression. This would confuse the compression mechanism and browser. I tried using `headers_sent()` to selectively disable compression but that didn't appear to fix this interaction (I think emitting this text does not cause headers to send, but does let contet escape into some buffer which the compressor can not access). Instead, push the header down a little bit so it renders after we activate compression. Also make it slightly fancier / more hideous. WOW. Test Plan: {F2122927} Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D17052 --- .../AphrontApplicationConfiguration.php | 13 +------ .../response/AphrontWebpageResponse.php | 34 ++++++++++++++++++- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/aphront/configuration/AphrontApplicationConfiguration.php b/src/aphront/configuration/AphrontApplicationConfiguration.php index aee2c63032..e7b3b85c63 100644 --- a/src/aphront/configuration/AphrontApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontApplicationConfiguration.php @@ -303,18 +303,7 @@ abstract class AphrontApplicationConfiguration extends Phobject { phlog($unexpected_output); if ($response instanceof AphrontWebpageResponse) { - echo phutil_tag( - 'div', - array( - 'style' => - 'background: #eeddff;'. - 'white-space: pre-wrap;'. - 'z-index: 200000;'. - 'position: relative;'. - 'padding: 8px;'. - 'font-family: monospace', - ), - $unexpected_output); + $response->setUnexpectedOutput($unexpected_output); } } diff --git a/src/aphront/response/AphrontWebpageResponse.php b/src/aphront/response/AphrontWebpageResponse.php index bda0d94244..de642f9b19 100644 --- a/src/aphront/response/AphrontWebpageResponse.php +++ b/src/aphront/response/AphrontWebpageResponse.php @@ -3,14 +3,46 @@ final class AphrontWebpageResponse extends AphrontHTMLResponse { private $content; + private $unexpectedOutput; public function setContent($content) { $this->content = $content; return $this; } + public function setUnexpectedOutput($unexpected_output) { + $this->unexpectedOutput = $unexpected_output; + return $this; + } + + public function getUnexpectedOutput() { + return $this->unexpectedOutput; + } + public function buildResponseString() { - return hsprintf('%s', $this->content); + $unexpected_output = $this->getUnexpectedOutput(); + if (strlen($unexpected_output)) { + $style = array( + 'background: linear-gradient(180deg, #eeddff, #ddbbff);', + 'white-space: pre-wrap;', + 'z-index: 200000;', + 'position: relative;', + 'padding: 16px;', + 'font-family: monospace;', + 'text-shadow: 1px 1px 1px white;', + ); + + $unexpected_header = phutil_tag( + 'div', + array( + 'style' => implode(' ', $style), + ), + $unexpected_output); + } else { + $unexpected_header = ''; + } + + return hsprintf('%s%s', $unexpected_header, $this->content); } } From 32ce21a18197316915708b34c3bbb96a0306462a Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 14 Dec 2016 05:34:50 -0800 Subject: [PATCH 31/78] Allow the new Differential EditEngine form to create/update diffs for revisions Summary: Ref T11114. Much of this is around making the "comment-while-updating" flow work correctly. Test Plan: - Created new diffs by copy/pasting, then: - used one to create a new revision; - used one to update an existing revision, with a comment. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17053 --- src/__phutil_library_map__.php | 4 ++ .../PhabricatorDifferentialApplication.php | 2 + .../DifferentialRevisionEditProController.php | 50 ++++++++++++++- .../editor/DifferentialRevisionEditEngine.php | 63 ++++++++++++++++++- .../editfield/PhabricatorCommentEditField.php | 25 +++++++- .../editfield/PhabricatorDividerEditField.php | 18 ++++++ .../editfield/PhabricatorSubmitEditField.php | 19 ++++++ 7 files changed, 174 insertions(+), 7 deletions(-) create mode 100644 src/applications/transactions/editfield/PhabricatorDividerEditField.php create mode 100644 src/applications/transactions/editfield/PhabricatorSubmitEditField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index a738c0ea81..741ca1290d 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2514,6 +2514,7 @@ phutil_register_library_map(array( 'PhabricatorDisabledUserController' => 'applications/auth/controller/PhabricatorDisabledUserController.php', 'PhabricatorDisplayPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php', 'PhabricatorDisqusAuthProvider' => 'applications/auth/provider/PhabricatorDisqusAuthProvider.php', + 'PhabricatorDividerEditField' => 'applications/transactions/editfield/PhabricatorDividerEditField.php', 'PhabricatorDividerProfileMenuItem' => 'applications/search/menuitem/PhabricatorDividerProfileMenuItem.php', 'PhabricatorDivinerApplication' => 'applications/diviner/application/PhabricatorDivinerApplication.php', 'PhabricatorDoorkeeperApplication' => 'applications/doorkeeper/application/PhabricatorDoorkeeperApplication.php', @@ -3825,6 +3826,7 @@ phutil_register_library_map(array( 'PhabricatorStreamingProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorStreamingProtocolAdapter.php', 'PhabricatorStringListEditField' => 'applications/transactions/editfield/PhabricatorStringListEditField.php', 'PhabricatorStringSetting' => 'applications/settings/setting/PhabricatorStringSetting.php', + 'PhabricatorSubmitEditField' => 'applications/transactions/editfield/PhabricatorSubmitEditField.php', 'PhabricatorSubscribableInterface' => 'applications/subscriptions/interface/PhabricatorSubscribableInterface.php', 'PhabricatorSubscribedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorSubscribedToObjectEdgeType.php', 'PhabricatorSubscribersEditField' => 'applications/transactions/editfield/PhabricatorSubscribersEditField.php', @@ -7468,6 +7470,7 @@ phutil_register_library_map(array( 'PhabricatorDisabledUserController' => 'PhabricatorAuthController', 'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 'PhabricatorDisqusAuthProvider' => 'PhabricatorOAuth2AuthProvider', + 'PhabricatorDividerEditField' => 'PhabricatorEditField', 'PhabricatorDividerProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorDivinerApplication' => 'PhabricatorApplication', 'PhabricatorDoorkeeperApplication' => 'PhabricatorApplication', @@ -9024,6 +9027,7 @@ phutil_register_library_map(array( 'PhabricatorStreamingProtocolAdapter' => 'PhabricatorProtocolAdapter', 'PhabricatorStringListEditField' => 'PhabricatorEditField', 'PhabricatorStringSetting' => 'PhabricatorSetting', + 'PhabricatorSubmitEditField' => 'PhabricatorEditField', 'PhabricatorSubscribedToObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorSubscribersEditField' => 'PhabricatorTokenizerEditField', 'PhabricatorSubscribersQuery' => 'PhabricatorQuery', diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php index d72fd2ddc8..142ef8b1b4 100644 --- a/src/applications/differential/application/PhabricatorDifferentialApplication.php +++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php @@ -69,6 +69,8 @@ final class PhabricatorDifferentialApplication extends PhabricatorApplication { => 'DifferentialRevisionEditController', $this->getEditRoutePattern('editpro/') => 'DifferentialRevisionEditProController', + $this->getEditRoutePattern('attach/(?P[^/]+)/to/') + => 'DifferentialRevisionEditProController', 'land/(?:(?P[1-9]\d*))/(?P[^/]+)/' => 'DifferentialRevisionLandController', 'closedetails/(?P[^/]+)/' diff --git a/src/applications/differential/controller/DifferentialRevisionEditProController.php b/src/applications/differential/controller/DifferentialRevisionEditProController.php index 9c1257dac9..d61a6e4c0b 100644 --- a/src/applications/differential/controller/DifferentialRevisionEditProController.php +++ b/src/applications/differential/controller/DifferentialRevisionEditProController.php @@ -4,9 +4,53 @@ final class DifferentialRevisionEditProController extends DifferentialController { public function handleRequest(AphrontRequest $request) { - return id(new DifferentialRevisionEditEngine()) - ->setController($this) - ->buildResponse(); + $viewer = $this->getViewer(); + + // If we have a Diff ID, this is an "/attach/123/to/456/" action. The + // user just created a diff and is trying to use it to create or update + // a revision. + $diff_id = $request->getURIData('diffID'); + + if ($diff_id) { + $diff = id(new DifferentialDiffQuery()) + ->setViewer($viewer) + ->withIDs(array($diff_id)) + ->executeOne(); + if (!$diff) { + return new Aphront404Response(); + } + + if ($diff->getRevisionID()) { + $revision = $diff->getRevision(); + return $this->newDialog() + ->setTitle(pht('Diff Already Attached')) + ->appendParagraph( + pht( + 'This diff is already attached to a revision.')) + ->addCancelButton($revision->getURI(), pht('Continue')); + } + } else { + $diff = null; + } + + $revision_id = $request->getURIData('id'); + if (!$diff && !$revision_id) { + return $this->newDialog() + ->setTitle(pht('Diff Required')) + ->appendParagraph( + pht( + 'You can not create a revision without a diff.')) + ->addCancelButton($this->getApplicationURI()); + } + + $engine = id(new DifferentialRevisionEditEngine()) + ->setController($this); + + if ($diff) { + $engine->setDiff($diff); + } + + return $engine->buildResponse(); } } diff --git a/src/applications/differential/editor/DifferentialRevisionEditEngine.php b/src/applications/differential/editor/DifferentialRevisionEditEngine.php index 1e096db3ad..b4f0e429a1 100644 --- a/src/applications/differential/editor/DifferentialRevisionEditEngine.php +++ b/src/applications/differential/editor/DifferentialRevisionEditEngine.php @@ -3,6 +3,8 @@ final class DifferentialRevisionEditEngine extends PhabricatorEditEngine { + private $diff; + const ENGINECONST = 'differential.revision'; public function getEngineName() { @@ -33,6 +35,7 @@ final class DifferentialRevisionEditEngine protected function newObjectQuery() { return id(new DifferentialRevisionQuery()) + ->needActiveDiffs(true) ->needReviewerStatus(true); } @@ -41,7 +44,15 @@ final class DifferentialRevisionEditEngine } protected function getObjectEditTitleText($object) { - return pht('Edit Revision: %s', $object->getTitle()); + $monogram = $object->getMonogram(); + $title = $object->getTitle(); + + $diff = $this->getDiff(); + if ($diff) { + return pht('Update Revision %s: %s', $monogram, $title); + } else { + return pht('Edit Revision %s: %s', $monogram, $title); + } } protected function getObjectEditShortText($object) { @@ -60,6 +71,15 @@ final class DifferentialRevisionEditEngine return $object->getURI(); } + public function setDiff(DifferentialDiff $diff) { + $this->diff = $diff; + return $this; + } + + public function getDiff() { + return $this->diff; + } + protected function buildCustomEditFields($object) { $plan_required = PhabricatorEnv::getEnvConfig( @@ -68,7 +88,48 @@ final class DifferentialRevisionEditEngine $object, 'differential:test-plan'); + $diff = $this->getDiff(); + if ($diff) { + $diff_phid = $diff->getPHID(); + } else { + $diff_phid = null; + } + + $is_update = ($diff && $object->getID()); + $fields = array(); + + $fields[] = id(new PhabricatorHandlesEditField()) + ->setKey('update') + ->setLabel(pht('Update Diff')) + ->setDescription(pht('New diff to create or update the revision with.')) + ->setConduitDescription(pht('Create or update a revision with a diff.')) + ->setConduitTypeDescription(pht('PHID of the diff.')) + ->setTransactionType(DifferentialTransaction::TYPE_UPDATE) + ->setHandleParameterType(new AphrontPHIDListHTTPParameterType()) + ->setSingleValue($diff_phid) + ->setIsReorderable(false) + ->setIsDefaultable(false) + ->setIsInvisible(true) + ->setIsLockable(false); + + if ($is_update) { + $fields[] = id(new PhabricatorInstructionsEditField()) + ->setKey('update.help') + ->setValue(pht('Describe the updates you have made to the diff.')); + $fields[] = id(new PhabricatorCommentEditField()) + ->setKey('update.comment') + ->setLabel(pht('Comment')) + ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) + ->setIsWebOnly(true) + ->setDescription(pht('Comments providing context for the update.')); + $fields[] = id(new PhabricatorSubmitEditField()) + ->setKey('update.submit') + ->setValue($this->getObjectEditButtonText($object)); + $fields[] = id(new PhabricatorDividerEditField()) + ->setKey('update.note'); + } + $fields[] = id(new PhabricatorTextEditField()) ->setKey('title') ->setLabel(pht('Title')) diff --git a/src/applications/transactions/editfield/PhabricatorCommentEditField.php b/src/applications/transactions/editfield/PhabricatorCommentEditField.php index 5d9c2b54da..f04002ed92 100644 --- a/src/applications/transactions/editfield/PhabricatorCommentEditField.php +++ b/src/applications/transactions/editfield/PhabricatorCommentEditField.php @@ -3,6 +3,17 @@ final class PhabricatorCommentEditField extends PhabricatorEditField { + private $isWebOnly; + + public function setIsWebOnly($is_web_only) { + $this->isWebOnly = $is_web_only; + return $this; + } + + public function getIsWebOnly() { + return $this->isWebOnly; + } + protected function newControl() { return new PhabricatorRemarkupControl(); } @@ -12,15 +23,23 @@ final class PhabricatorCommentEditField } protected function newConduitParameterType() { - return new ConduitStringParameterType(); + if ($this->getIsWebOnly()) { + return null; + } else { + return new ConduitStringParameterType(); + } } public function shouldGenerateTransactionsFromSubmit() { - return false; + return !$this->isPrimaryCommentField(); } public function shouldGenerateTransactionsFromComment() { - return true; + return $this->isPrimaryCommentField(); + } + + private function isPrimaryCommentField() { + return ($this->getKey() === 'comment'); } } diff --git a/src/applications/transactions/editfield/PhabricatorDividerEditField.php b/src/applications/transactions/editfield/PhabricatorDividerEditField.php new file mode 100644 index 0000000000..553c5256bc --- /dev/null +++ b/src/applications/transactions/editfield/PhabricatorDividerEditField.php @@ -0,0 +1,18 @@ +setValue($this->getValue()); + } + + protected function newHTTPParameterType() { + return null; + } + + protected function newConduitParameterType() { + return null; + } + +} From 102ea3cfa41da205614f339bce8c61cf21aeb271 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Dec 2016 15:39:10 -0800 Subject: [PATCH 32/78] Replace Differential Edit controller with EditEngine-driven EditPro controller Summary: Ref T11114. This replaces the old edit controller with a new one based entirely on EditEngine. This removes the CustomFieldEditEngineExtension hack for Differential, since remaining field types are fairly straightforward and work with existing EditEngine support, as far as I can tell. Test Plan: - Created a revision via web diffs. - Updated a revision via web diffs. - Edited a revision via web. - Edited nonstandard custom fields ("Blame Revision", "JIRA Issues"). - Created a revision via CLI. - Updated a revision via CLI. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17054 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialApplication.php | 2 - .../DifferentialDiffViewController.php | 24 +- .../DifferentialRevisionEditController.php | 214 ------------------ .../DifferentialRevisionViewController.php | 2 +- .../DifferentialCoreCustomField.php | 4 - .../DifferentialManiphestTasksField.php | 4 - .../customfield/DifferentialProjectsField.php | 4 - .../DifferentialRequiredSignaturesField.php | 4 - .../DifferentialReviewedByField.php | 4 - .../editor/DifferentialRevisionEditEngine.php | 33 +-- .../storage/DifferentialRevision.php | 1 + .../PhabricatorCustomFieldEditField.php | 13 +- ...bricatorCustomFieldEditEngineExtension.php | 6 - 14 files changed, 42 insertions(+), 275 deletions(-) delete mode 100644 src/applications/differential/controller/DifferentialRevisionEditController.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 741ca1290d..ae8760090d 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -517,7 +517,6 @@ phutil_register_library_map(array( 'DifferentialRevisionControlSystem' => 'applications/differential/constants/DifferentialRevisionControlSystem.php', 'DifferentialRevisionDependedOnByRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependedOnByRevisionEdgeType.php', 'DifferentialRevisionDependsOnRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependsOnRevisionEdgeType.php', - 'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php', 'DifferentialRevisionEditEngine' => 'applications/differential/editor/DifferentialRevisionEditEngine.php', 'DifferentialRevisionEditProController' => 'applications/differential/controller/DifferentialRevisionEditProController.php', 'DifferentialRevisionFulltextEngine' => 'applications/differential/search/DifferentialRevisionFulltextEngine.php', @@ -5173,7 +5172,6 @@ phutil_register_library_map(array( 'DifferentialRevisionControlSystem' => 'Phobject', 'DifferentialRevisionDependedOnByRevisionEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionDependsOnRevisionEdgeType' => 'PhabricatorEdgeType', - 'DifferentialRevisionEditController' => 'DifferentialController', 'DifferentialRevisionEditEngine' => 'PhabricatorEditEngine', 'DifferentialRevisionEditProController' => 'DifferentialController', 'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine', diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php index 142ef8b1b4..b84da25e52 100644 --- a/src/applications/differential/application/PhabricatorDifferentialApplication.php +++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php @@ -65,8 +65,6 @@ final class PhabricatorDifferentialApplication extends PhabricatorApplication { ), 'changeset/' => 'DifferentialChangesetViewController', 'revision/' => array( - 'edit/(?:(?P[1-9]\d*)/)?' - => 'DifferentialRevisionEditController', $this->getEditRoutePattern('editpro/') => 'DifferentialRevisionEditProController', $this->getEditRoutePattern('attach/(?P[^/]+)/to/') diff --git a/src/applications/differential/controller/DifferentialDiffViewController.php b/src/applications/differential/controller/DifferentialDiffViewController.php index b2c497f6ac..dae65bb200 100644 --- a/src/applications/differential/controller/DifferentialDiffViewController.php +++ b/src/applications/differential/controller/DifferentialDiffViewController.php @@ -23,6 +23,20 @@ final class DifferentialDiffViewController extends DifferentialController { ->setURI('/D'.$diff->getRevisionID().'?id='.$diff->getID()); } + if ($request->isFormPost()) { + $diff_id = $diff->getID(); + $revision_id = $request->getInt('revisionID'); + if ($revision_id) { + $attach_uri = "/revision/attach/{$diff_id}/to/{$revision_id}/"; + } else { + $attach_uri = "/revision/attach/{$diff_id}/to/"; + } + $attach_uri = $this->getApplicationURI($attach_uri); + + return id(new AphrontRedirectResponse()) + ->setURI($attach_uri); + } + $diff_phid = $diff->getPHID(); $buildables = id(new HarbormasterBuildableQuery()) ->setViewer($viewer) @@ -78,13 +92,7 @@ final class DifferentialDiffViewController extends DifferentialController { $select); $form = id(new AphrontFormView()) - ->setUser($request->getUser()) - ->setAction('/differential/revision/edit/') - ->addHiddenInput('diffID', $diff->getID()) - ->addHiddenInput('viaDiffView', 1) - ->addHiddenInput( - id(new DifferentialRepositoryField())->getFieldKey(), - $diff->getRepositoryPHID()) + ->setViewer($viewer) ->appendRemarkupInstructions( pht( 'Review the diff for correctness. When you are satisfied, either '. @@ -98,7 +106,7 @@ final class DifferentialDiffViewController extends DifferentialController { ->setValue(pht('Continue'))); $props = id(new DifferentialDiffProperty())->loadAllWhere( - 'diffID = %d', + 'diffID = %d', $diff->getID()); $props = mpull($props, 'getData', 'getName'); diff --git a/src/applications/differential/controller/DifferentialRevisionEditController.php b/src/applications/differential/controller/DifferentialRevisionEditController.php deleted file mode 100644 index eb3aa08521..0000000000 --- a/src/applications/differential/controller/DifferentialRevisionEditController.php +++ /dev/null @@ -1,214 +0,0 @@ -getViewer(); - $id = $request->getURIData('id'); - - if (!$id) { - $id = $request->getInt('revisionID'); - } - - if ($id) { - $revision = id(new DifferentialRevisionQuery()) - ->setViewer($viewer) - ->withIDs(array($id)) - ->needRelationships(true) - ->needReviewerStatus(true) - ->needActiveDiffs(true) - ->requireCapabilities( - array( - PhabricatorPolicyCapability::CAN_VIEW, - PhabricatorPolicyCapability::CAN_EDIT, - )) - ->executeOne(); - if (!$revision) { - return new Aphront404Response(); - } - } else { - $revision = DifferentialRevision::initializeNewRevision($viewer); - $revision->attachReviewerStatus(array()); - } - - $diff_id = $request->getInt('diffID'); - if ($diff_id) { - $diff = id(new DifferentialDiffQuery()) - ->setViewer($viewer) - ->withIDs(array($diff_id)) - ->executeOne(); - if (!$diff) { - return new Aphront404Response(); - } - if ($diff->getRevisionID()) { - // TODO: Redirect? - throw new Exception( - pht('This diff is already attached to a revision!')); - } - } else { - $diff = null; - } - - if (!$diff) { - if (!$revision->getID()) { - throw new Exception( - pht('You can not create a new revision without a diff!')); - } - } else { - // TODO: It would be nice to show the diff being attached in the UI. - } - - $field_list = PhabricatorCustomField::getObjectFields( - $revision, - PhabricatorCustomField::ROLE_EDIT); - $field_list - ->setViewer($viewer) - ->readFieldsFromStorage($revision); - - if ($request->getStr('viaDiffView') && $diff) { - $repo_key = id(new DifferentialRepositoryField())->getFieldKey(); - $repository_field = idx( - $field_list->getFields(), - $repo_key); - if ($repository_field) { - $repository_field->setValue($request->getStr($repo_key)); - } - $view_policy_key = id(new DifferentialViewPolicyField())->getFieldKey(); - $view_policy_field = idx( - $field_list->getFields(), - $view_policy_key); - if ($view_policy_field) { - $view_policy_field->setValue($diff->getViewPolicy()); - } - } - - $validation_exception = null; - if ($request->isFormPost() && !$request->getStr('viaDiffView')) { - - $editor = id(new DifferentialTransactionEditor()) - ->setActor($viewer) - ->setContentSourceFromRequest($request) - ->setContinueOnNoEffect(true); - - $xactions = $field_list->buildFieldTransactionsFromRequest( - new DifferentialTransaction(), - $request); - - if ($diff) { - $repository_phid = null; - $repository_tokenizer = $request->getArr( - id(new DifferentialRepositoryField())->getFieldKey()); - if ($repository_tokenizer) { - $repository_phid = reset($repository_tokenizer); - } - - $xactions[] = id(new DifferentialTransaction()) - ->setTransactionType(DifferentialTransaction::TYPE_UPDATE) - ->setNewValue($diff->getPHID()); - - $editor->setRepositoryPHIDOverride($repository_phid); - } - - $comments = $request->getStr('comments'); - if (strlen($comments)) { - $xactions[] = id(new DifferentialTransaction()) - ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) - ->attachComment( - id(new DifferentialTransactionComment()) - ->setContent($comments)); - } - - try { - $editor->applyTransactions($revision, $xactions); - $revision_uri = '/D'.$revision->getID(); - return id(new AphrontRedirectResponse())->setURI($revision_uri); - } catch (PhabricatorApplicationTransactionValidationException $ex) { - $validation_exception = $ex; - } - } - - - $form = new AphrontFormView(); - $form->setUser($request->getUser()); - if ($diff) { - $form->addHiddenInput('diffID', $diff->getID()); - } - - if ($revision->getID()) { - $form->setAction('/differential/revision/edit/'.$revision->getID().'/'); - } else { - $form->setAction('/differential/revision/edit/'); - } - - if ($diff && $revision->getID()) { - $form - ->appendChild( - id(new AphrontFormTextAreaControl()) - ->setLabel(pht('Comments')) - ->setName('comments') - ->setCaption(pht("Explain what's new in this diff.")) - ->setValue($request->getStr('comments'))) - ->appendChild( - id(new AphrontFormSubmitControl()) - ->setValue(pht('Save'))) - ->appendChild( - id(new AphrontFormDividerControl())); - } - - $field_list->appendFieldsToForm($form); - - $submit = id(new AphrontFormSubmitControl()) - ->setValue('Save'); - if ($diff) { - $submit->addCancelButton('/differential/diff/'.$diff->getID().'/'); - } else { - $submit->addCancelButton('/D'.$revision->getID()); - } - - $form->appendChild($submit); - - $crumbs = $this->buildApplicationCrumbs(); - if ($revision->getID()) { - if ($diff) { - $header_icon = 'fa-upload'; - $title = pht('Update Revision'); - $crumbs->addTextCrumb( - 'D'.$revision->getID(), - '/differential/diff/'.$diff->getID().'/'); - } else { - $header_icon = 'fa-pencil'; - $title = pht('Edit Revision: %s', $revision->getTitle()); - $crumbs->addTextCrumb( - 'D'.$revision->getID(), - '/D'.$revision->getID()); - } - } else { - $header_icon = 'fa-plus-square'; - $title = pht('Create New Differential Revision'); - } - - $form_box = id(new PHUIObjectBoxView()) - ->setHeaderText('Revision') - ->setValidationException($validation_exception) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setForm($form); - - $crumbs->addTextCrumb($title); - $crumbs->setBorder(true); - - $header = id(new PHUIHeaderView()) - ->setHeader($title) - ->setHeaderIcon($header_icon); - - $view = id(new PHUITwoColumnView()) - ->setHeader($header) - ->setFooter($form_box); - - return $this->newPage() - ->setTitle($title) - ->setCrumbs($crumbs) - ->appendChild($view); - } - -} diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 390c90b2e9..b5780ae356 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -570,7 +570,7 @@ final class DifferentialRevisionViewController extends DifferentialController { $curtain->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') - ->setHref("/differential/revision/edit/{$revision_id}/") + ->setHref("/differential/revision/editpro/{$revision_id}/") ->setName(pht('Edit Revision')) ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit)); diff --git a/src/applications/differential/customfield/DifferentialCoreCustomField.php b/src/applications/differential/customfield/DifferentialCoreCustomField.php index 7b6d02276d..d4181a31e7 100644 --- a/src/applications/differential/customfield/DifferentialCoreCustomField.php +++ b/src/applications/differential/customfield/DifferentialCoreCustomField.php @@ -118,10 +118,6 @@ abstract class DifferentialCoreCustomField return true; } - public function shouldAppearInEditView() { - return true; - } - public function readValueFromObject(PhabricatorCustomFieldInterface $object) { if ($this->isCoreFieldRequired()) { $this->setFieldError(true); diff --git a/src/applications/differential/customfield/DifferentialManiphestTasksField.php b/src/applications/differential/customfield/DifferentialManiphestTasksField.php index 56803f60c3..1724338d97 100644 --- a/src/applications/differential/customfield/DifferentialManiphestTasksField.php +++ b/src/applications/differential/customfield/DifferentialManiphestTasksField.php @@ -15,10 +15,6 @@ final class DifferentialManiphestTasksField return false; } - public function shouldAppearInEditView() { - return false; - } - public function getFieldName() { return pht('Maniphest Tasks'); } diff --git a/src/applications/differential/customfield/DifferentialProjectsField.php b/src/applications/differential/customfield/DifferentialProjectsField.php index 425e30e132..dc126ef8dc 100644 --- a/src/applications/differential/customfield/DifferentialProjectsField.php +++ b/src/applications/differential/customfield/DifferentialProjectsField.php @@ -19,10 +19,6 @@ final class DifferentialProjectsField return false; } - public function shouldAppearInEditView() { - return true; - } - public function shouldAppearInApplicationTransactions() { return true; } diff --git a/src/applications/differential/customfield/DifferentialRequiredSignaturesField.php b/src/applications/differential/customfield/DifferentialRequiredSignaturesField.php index 2408daa27c..421c129fdb 100644 --- a/src/applications/differential/customfield/DifferentialRequiredSignaturesField.php +++ b/src/applications/differential/customfield/DifferentialRequiredSignaturesField.php @@ -19,10 +19,6 @@ final class DifferentialRequiredSignaturesField return true; } - public function shouldAppearInEditView() { - return false; - } - protected function readValueFromRevision(DifferentialRevision $revision) { return self::loadForRevision($revision); } diff --git a/src/applications/differential/customfield/DifferentialReviewedByField.php b/src/applications/differential/customfield/DifferentialReviewedByField.php index 6f49c80fef..b0331f2a6e 100644 --- a/src/applications/differential/customfield/DifferentialReviewedByField.php +++ b/src/applications/differential/customfield/DifferentialReviewedByField.php @@ -23,10 +23,6 @@ final class DifferentialReviewedByField return false; } - public function shouldAppearInEditView() { - return false; - } - public function canDisableField() { return true; } diff --git a/src/applications/differential/editor/DifferentialRevisionEditEngine.php b/src/applications/differential/editor/DifferentialRevisionEditEngine.php index b4f0e429a1..4abac25f47 100644 --- a/src/applications/differential/editor/DifferentialRevisionEditEngine.php +++ b/src/applications/differential/editor/DifferentialRevisionEditEngine.php @@ -95,23 +95,26 @@ final class DifferentialRevisionEditEngine $diff_phid = null; } - $is_update = ($diff && $object->getID()); + $is_create = $this->getIsCreate(); + $is_update = ($diff && !$is_create); $fields = array(); - $fields[] = id(new PhabricatorHandlesEditField()) - ->setKey('update') - ->setLabel(pht('Update Diff')) - ->setDescription(pht('New diff to create or update the revision with.')) - ->setConduitDescription(pht('Create or update a revision with a diff.')) - ->setConduitTypeDescription(pht('PHID of the diff.')) - ->setTransactionType(DifferentialTransaction::TYPE_UPDATE) - ->setHandleParameterType(new AphrontPHIDListHTTPParameterType()) - ->setSingleValue($diff_phid) - ->setIsReorderable(false) - ->setIsDefaultable(false) - ->setIsInvisible(true) - ->setIsLockable(false); + if ($diff || $is_create) { + $fields[] = id(new PhabricatorHandlesEditField()) + ->setKey('update') + ->setLabel(pht('Update Diff')) + ->setDescription(pht('New diff to create or update the revision with.')) + ->setConduitDescription(pht('Create or update a revision with a diff.')) + ->setConduitTypeDescription(pht('PHID of the diff.')) + ->setTransactionType(DifferentialTransaction::TYPE_UPDATE) + ->setHandleParameterType(new AphrontPHIDListHTTPParameterType()) + ->setSingleValue($diff_phid) + ->setIsReorderable(false) + ->setIsDefaultable(false) + ->setIsInvisible(true) + ->setIsLockable(false); + } if ($is_update) { $fields[] = id(new PhabricatorInstructionsEditField()) @@ -194,7 +197,7 @@ final class DifferentialRevisionEditEngine private function isCustomFieldEnabled(DifferentialRevision $revision, $key) { $field_list = PhabricatorCustomField::getObjectFields( $revision, - PhabricatorCustomField::ROLE_EDIT); + PhabricatorCustomField::ROLE_VIEW); $fields = $field_list->getFields(); return isset($fields[$key]); diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index 906d89eacc..b6ed1994cc 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -70,6 +70,7 @@ final class DifferentialRevision extends DifferentialDAO ->setAuthorPHID($actor->getPHID()) ->attachRelationships(array()) ->attachRepository(null) + ->attachReviewerStatus(array()) ->setStatus(ArcanistDifferentialRevisionStatus::NEEDS_REVIEW); } diff --git a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php index 8d448f624b..72b359e7ea 100644 --- a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php +++ b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php @@ -47,14 +47,13 @@ final class PhabricatorCustomFieldEditField } protected function newEditType() { - $conduit_type = $this->newConduitParameterType(); - if (!$conduit_type) { - return null; - } - $type = id(new PhabricatorCustomFieldEditType()) - ->setCustomField($this->getCustomField()) - ->setConduitParameterType($conduit_type); + ->setCustomField($this->getCustomField()); + + $conduit_type = $this->newConduitParameterType(); + if ($conduit_type) { + $type->setConduitParameterType($conduit_type); + } return $type; } diff --git a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php index b38eb2961f..b9427905b8 100644 --- a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php +++ b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php @@ -27,12 +27,6 @@ final class PhabricatorCustomFieldEditEngineExtension PhabricatorEditEngine $engine, PhabricatorApplicationTransactionInterface $object) { - // TODO: Remove this hack once Differential modernizes more fully. Today, - // its custom fields are too custom to interact cleanly with EditEngine. - if ($object instanceof DifferentialRevision) { - return array(); - } - $viewer = $this->getViewer(); $field_list = PhabricatorCustomField::getObjectFields( From ae0e97a499743228551931a7d11e48b89b55f71e Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 14 Dec 2016 11:01:58 -0800 Subject: [PATCH 33/78] Remove unusual explicit calls to policy capability descriptions from Diviner Summary: Fixes T12015. This is weird and probably got copy/pasted from something else that was also being weird, since the methods were empty and I previously removed them. Test Plan: Edited a book in Diviner. Reviewers: chad, avivey Reviewed By: avivey Maniphest Tasks: T12015 Differential Revision: https://secure.phabricator.com/D17056 --- .../diviner/controller/DivinerBookEditController.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/applications/diviner/controller/DivinerBookEditController.php b/src/applications/diviner/controller/DivinerBookEditController.php index 758cc190bb..b783e96746 100644 --- a/src/applications/diviner/controller/DivinerBookEditController.php +++ b/src/applications/diviner/controller/DivinerBookEditController.php @@ -92,15 +92,13 @@ final class DivinerBookEditController extends DivinerController { ->setName('viewPolicy') ->setPolicyObject($book) ->setCapability($view_capability) - ->setPolicies($policies) - ->setCaption($book->describeAutomaticCapability($view_capability))) + ->setPolicies($policies)) ->appendChild( id(new AphrontFormPolicyControl()) ->setName('editPolicy') ->setPolicyObject($book) ->setCapability($edit_capability) - ->setPolicies($policies) - ->setCaption($book->describeAutomaticCapability($edit_capability))) + ->setPolicies($policies)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Save')) From e077d2f7a79ac595451a327aab729258926c1c8d Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 14 Dec 2016 11:35:51 -0800 Subject: [PATCH 34/78] Reorganize phui-object-item CSS, add drag ui Summary: Reorgaizes the CSS here a bit, by object list style, adds in a new drag ui class, which will be used in menu ordering. Test Plan: Workboards, Home Apps. {F2126266} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17057 --- resources/celerity/map.php | 110 ++- resources/celerity/packages.php | 7 +- .../meta/query/PhabricatorAppSearchEngine.php | 2 +- ...habricatorHomePreferencesSettingsPanel.php | 4 +- src/view/phui/PHUIObjectItemListView.php | 34 +- src/view/phui/PHUIObjectItemView.php | 100 +-- webroot/rsrc/css/aphront/dialog-view.css | 10 +- .../css/application/config/config-page.css | 2 +- webroot/rsrc/css/application/flag/flag.css | 2 +- .../css/application/project/project-view.css | 4 +- .../css/application/search/search-results.css | 2 +- .../layout/phabricator-source-code-view.css | 2 +- .../css/phui/object-item/phui-oi-big-ui.css | 48 ++ .../css/phui/object-item/phui-oi-color.css | 68 ++ .../css/phui/object-item/phui-oi-drag-ui.css | 59 ++ .../css/phui/object-item/phui-oi-flush-ui.css | 13 + .../phui/object-item/phui-oi-list-view.css | 625 ++++++++++++++ .../phui/object-item/phui-oi-simple-ui.css | 43 + webroot/rsrc/css/phui/phui-box.css | 14 +- webroot/rsrc/css/phui/phui-crumbs-view.css | 2 +- .../css/phui/phui-object-item-list-view.css | 790 ------------------ webroot/rsrc/css/phui/phui-tag-view.css | 4 +- .../rsrc/css/phui/phui-two-column-view.css | 2 +- .../css/phui/workboards/phui-workcard.css | 68 +- .../css/phui/workboards/phui-workpanel.css | 8 +- .../maniphest/behavior-batch-selector.js | 2 +- 26 files changed, 1072 insertions(+), 953 deletions(-) create mode 100644 webroot/rsrc/css/phui/object-item/phui-oi-big-ui.css create mode 100644 webroot/rsrc/css/phui/object-item/phui-oi-color.css create mode 100644 webroot/rsrc/css/phui/object-item/phui-oi-drag-ui.css create mode 100644 webroot/rsrc/css/phui/object-item/phui-oi-flush-ui.css create mode 100644 webroot/rsrc/css/phui/object-item/phui-oi-list-view.css create mode 100644 webroot/rsrc/css/phui/object-item/phui-oi-simple-ui.css delete mode 100644 webroot/rsrc/css/phui/phui-object-item-list-view.css diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 686bb008cb..b85ec8d42b 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '0b64e988', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => 'e18bf0da', + 'core.pkg.css' => '55d12594', 'core.pkg.js' => 'e4260032', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'a4ba74b5', @@ -18,10 +18,10 @@ return array( 'diffusion.pkg.js' => '84c8f8fd', 'favicon.ico' => '30672e08', 'maniphest.pkg.css' => '4845691a', - 'maniphest.pkg.js' => '949a7498', + 'maniphest.pkg.js' => '5ab2753f', 'rsrc/css/aphront/aphront-bars.css' => '231ac33c', 'rsrc/css/aphront/dark-console.css' => 'f54bf286', - 'rsrc/css/aphront/dialog-view.css' => '49b2a8a3', + 'rsrc/css/aphront/dialog-view.css' => '938f52c5', 'rsrc/css/aphront/list-filter-view.css' => '5d6f0526', 'rsrc/css/aphront/multi-column.css' => '84cc6640', 'rsrc/css/aphront/notification.css' => '3f6c89c9', @@ -42,7 +42,7 @@ return array( 'rsrc/css/application/chatlog/chatlog.css' => 'd295b020', 'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4', 'rsrc/css/application/config/config-options.css' => '0ede4c9b', - 'rsrc/css/application/config/config-page.css' => 'b80124ae', + 'rsrc/css/application/config/config-page.css' => 'c1d5121b', 'rsrc/css/application/config/config-template.css' => '8f18fa41', 'rsrc/css/application/config/setup-issue.css' => 'f794cfc3', 'rsrc/css/application/config/unhandled-exception.css' => '4c96257a', @@ -71,7 +71,7 @@ return array( 'rsrc/css/application/diffusion/diffusion-source.css' => '68b30fd3', 'rsrc/css/application/feed/feed.css' => 'ecd4ec57', 'rsrc/css/application/files/global-drag-and-drop.css' => '5c1b47c2', - 'rsrc/css/application/flag/flag.css' => '5337623f', + 'rsrc/css/application/flag/flag.css' => 'bba8f811', 'rsrc/css/application/harbormaster/harbormaster.css' => 'f491c9f4', 'rsrc/css/application/herald/herald-test.css' => 'a52e323e', 'rsrc/css/application/herald/herald.css' => 'dc31f6e9', @@ -97,13 +97,13 @@ return array( 'rsrc/css/application/policy/policy.css' => '957ea14c', 'rsrc/css/application/ponder/ponder-view.css' => 'fbd45f96', 'rsrc/css/application/project/project-card-view.css' => '9418c97d', - 'rsrc/css/application/project/project-view.css' => '55d99221', + 'rsrc/css/application/project/project-view.css' => '1e6f7072', 'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733', 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', 'rsrc/css/application/releeph/releeph-request-differential-create-dialog.css' => '8d8b92cd', 'rsrc/css/application/releeph/releeph-request-typeahead.css' => '667a48ae', 'rsrc/css/application/search/application-search-view.css' => '8452c849', - 'rsrc/css/application/search/search-results.css' => '7dea472c', + 'rsrc/css/application/search/search-results.css' => '64ad079a', 'rsrc/css/application/slowvote/slowvote.css' => 'a94b7230', 'rsrc/css/application/tokens/tokens.css' => '3d0f239e', 'rsrc/css/application/uiexample/example.css' => '528b19de', @@ -117,23 +117,29 @@ return array( 'rsrc/css/font/font-lato.css' => 'c7ccd872', 'rsrc/css/font/phui-font-icon-base.css' => '870a7360', 'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82', - 'rsrc/css/layout/phabricator-source-code-view.css' => 'cbeef983', + 'rsrc/css/layout/phabricator-source-code-view.css' => '4383192f', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '572b1893', 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'fcc9fb41', 'rsrc/css/phui/calendar/phui-calendar-month.css' => '8e10e92c', 'rsrc/css/phui/calendar/phui-calendar.css' => '477acfaa', + 'rsrc/css/phui/object-item/phui-oi-big-ui.css' => '19f9369b', + 'rsrc/css/phui/object-item/phui-oi-color.css' => 'cd2b9b77', + 'rsrc/css/phui/object-item/phui-oi-drag-ui.css' => 'f12cbc9f', + 'rsrc/css/phui/object-item/phui-oi-flush-ui.css' => '9d9685d6', + 'rsrc/css/phui/object-item/phui-oi-list-view.css' => 'bff632a4', + 'rsrc/css/phui/object-item/phui-oi-simple-ui.css' => 'a8beebea', 'rsrc/css/phui/phui-action-list.css' => 'e1d48300', 'rsrc/css/phui/phui-action-panel.css' => '91c7b835', 'rsrc/css/phui/phui-badge.css' => '3baef8db', 'rsrc/css/phui/phui-basic-nav-view.css' => '7093573b', 'rsrc/css/phui/phui-big-info-view.css' => 'bd903741', - 'rsrc/css/phui/phui-box.css' => '5c8387cf', + 'rsrc/css/phui/phui-box.css' => '33b629f8', 'rsrc/css/phui/phui-button.css' => '43f4912e', 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 'rsrc/css/phui/phui-cms.css' => 'be43c8a8', 'rsrc/css/phui/phui-comment-form.css' => 'c953b75e', 'rsrc/css/phui/phui-comment-panel.css' => 'f50152ad', - 'rsrc/css/phui/phui-crumbs-view.css' => '195ac419', + 'rsrc/css/phui/phui-crumbs-view.css' => 'f82868f2', 'rsrc/css/phui/phui-curtain-view.css' => '947bf1a4', 'rsrc/css/phui/phui-document-pro.css' => 'c354e312', 'rsrc/css/phui/phui-document-summary.css' => '9ca48bdf', @@ -154,7 +160,6 @@ return array( 'rsrc/css/phui/phui-lightbox.css' => '0a035e40', 'rsrc/css/phui/phui-list.css' => '9da2aa00', 'rsrc/css/phui/phui-object-box.css' => '6b487c57', - 'rsrc/css/phui/phui-object-item-list-view.css' => '87278fa0', 'rsrc/css/phui/phui-pager.css' => 'bea33d23', 'rsrc/css/phui/phui-pinboard-view.css' => '2495140e', 'rsrc/css/phui/phui-profile-menu.css' => '4768721a', @@ -163,13 +168,13 @@ return array( 'rsrc/css/phui/phui-segment-bar-view.css' => '46342871', 'rsrc/css/phui/phui-spacing.css' => '042804d6', 'rsrc/css/phui/phui-status.css' => 'd5263e49', - 'rsrc/css/phui/phui-tag-view.css' => '6bbd83e2', + 'rsrc/css/phui/phui-tag-view.css' => '84d65f26', 'rsrc/css/phui/phui-timeline-view.css' => 'bc523970', - 'rsrc/css/phui/phui-two-column-view.css' => 'f662d744', + 'rsrc/css/phui/phui-two-column-view.css' => '7babf5b9', 'rsrc/css/phui/workboards/phui-workboard-color.css' => 'b60ef38a', 'rsrc/css/phui/workboards/phui-workboard.css' => '16441d5e', - 'rsrc/css/phui/workboards/phui-workcard.css' => '0c62d7c5', - 'rsrc/css/phui/workboards/phui-workpanel.css' => '92197373', + 'rsrc/css/phui/workboards/phui-workcard.css' => '00979e40', + 'rsrc/css/phui/workboards/phui-workpanel.css' => 'a3a63478', 'rsrc/css/sprite-login.css' => '587d92d7', 'rsrc/css/sprite-tokens.css' => '9cdfd599', 'rsrc/css/syntax/syntax-default.css' => '9923583c', @@ -420,7 +425,7 @@ return array( 'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec', 'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3', 'rsrc/js/application/maniphest/behavior-batch-editor.js' => '782ab6e7', - 'rsrc/js/application/maniphest/behavior-batch-selector.js' => '7b98d7c5', + 'rsrc/js/application/maniphest/behavior-batch-selector.js' => '0825c27a', 'rsrc/js/application/maniphest/behavior-line-chart.js' => 'e4232876', 'rsrc/js/application/maniphest/behavior-list-edit.js' => 'a9f88de2', 'rsrc/js/application/maniphest/behavior-subpriorityeditor.js' => '71237763', @@ -544,7 +549,7 @@ return array( 'almanac-css' => 'dbb9b3af', 'aphront-bars' => '231ac33c', 'aphront-dark-console-css' => 'f54bf286', - 'aphront-dialog-view-css' => '49b2a8a3', + 'aphront-dialog-view-css' => '938f52c5', 'aphront-list-filter-view-css' => '5d6f0526', 'aphront-multi-column-view-css' => '84cc6640', 'aphront-panel-view-css' => '8427b78d', @@ -558,7 +563,7 @@ return array( 'changeset-view-manager' => 'a2828756', 'conduit-api-css' => '7bc725c4', 'config-options-css' => '0ede4c9b', - 'config-page-css' => 'b80124ae', + 'config-page-css' => 'c1d5121b', 'conpherence-durable-column-view' => 'd82e130c', 'conpherence-header-pane-css' => '1c81cda6', 'conpherence-menu-css' => '4f51db5a', @@ -654,7 +659,7 @@ return array( 'javelin-behavior-line-chart' => 'e4232876', 'javelin-behavior-load-blame' => '42126667', 'javelin-behavior-maniphest-batch-editor' => '782ab6e7', - 'javelin-behavior-maniphest-batch-selector' => '7b98d7c5', + 'javelin-behavior-maniphest-batch-selector' => '0825c27a', 'javelin-behavior-maniphest-list-editor' => 'a9f88de2', 'javelin-behavior-maniphest-subpriority-editor' => '71237763', 'javelin-behavior-owners-path-editor' => '7a68dda3', @@ -790,7 +795,7 @@ return array( 'phabricator-feed-css' => 'ecd4ec57', 'phabricator-file-upload' => '680ea2c8', 'phabricator-filetree-view-css' => 'fccf9f82', - 'phabricator-flag-css' => '5337623f', + 'phabricator-flag-css' => 'bba8f811', 'phabricator-keyboard-shortcut' => '1ae869f2', 'phabricator-keyboard-shortcut-manager' => '4a021c10', 'phabricator-main-menu-view' => 'f03e17be', @@ -802,10 +807,10 @@ return array( 'phabricator-phtize' => 'd254d646', 'phabricator-prefab' => '8d40ae75', 'phabricator-remarkup-css' => '8606d9c6', - 'phabricator-search-results-css' => '7dea472c', + 'phabricator-search-results-css' => '64ad079a', 'phabricator-shaped-request' => '7cbe244b', 'phabricator-slowvote-css' => 'a94b7230', - 'phabricator-source-code-view-css' => 'cbeef983', + 'phabricator-source-code-view-css' => '4383192f', 'phabricator-standard-page-view' => '894d8a25', 'phabricator-textareautils' => '320810c8', 'phabricator-title' => '485aaa6c', @@ -836,7 +841,7 @@ return array( 'phui-badge-view-css' => '3baef8db', 'phui-basic-nav-view-css' => '7093573b', 'phui-big-info-view-css' => 'bd903741', - 'phui-box-css' => '5c8387cf', + 'phui-box-css' => '33b629f8', 'phui-button-css' => '43f4912e', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', @@ -846,7 +851,7 @@ return array( 'phui-cms-css' => 'be43c8a8', 'phui-comment-form-css' => 'c953b75e', 'phui-comment-panel-css' => 'f50152ad', - 'phui-crumbs-view-css' => '195ac419', + 'phui-crumbs-view-css' => 'f82868f2', 'phui-curtain-view-css' => '947bf1a4', 'phui-document-summary-view-css' => '9ca48bdf', 'phui-document-view-css' => 'c32e8dec', @@ -870,7 +875,12 @@ return array( 'phui-lightbox-css' => '0a035e40', 'phui-list-view-css' => '9da2aa00', 'phui-object-box-css' => '6b487c57', - 'phui-object-item-list-view-css' => '87278fa0', + 'phui-oi-big-ui-css' => '19f9369b', + 'phui-oi-color-css' => 'cd2b9b77', + 'phui-oi-drag-ui-css' => 'f12cbc9f', + 'phui-oi-flush-ui-css' => '9d9685d6', + 'phui-oi-list-view-css' => 'bff632a4', + 'phui-oi-simple-ui-css' => 'a8beebea', 'phui-pager-css' => 'bea33d23', 'phui-pinboard-view-css' => '2495140e', 'phui-profile-menu-css' => '4768721a', @@ -879,14 +889,14 @@ return array( 'phui-segment-bar-view-css' => '46342871', 'phui-spacing-css' => '042804d6', 'phui-status-list-view-css' => 'd5263e49', - 'phui-tag-view-css' => '6bbd83e2', + 'phui-tag-view-css' => '84d65f26', 'phui-theme-css' => '798c69b8', 'phui-timeline-view-css' => 'bc523970', - 'phui-two-column-view-css' => 'f662d744', + 'phui-two-column-view-css' => '7babf5b9', 'phui-workboard-color-css' => 'b60ef38a', 'phui-workboard-view-css' => '16441d5e', - 'phui-workcard-view-css' => '0c62d7c5', - 'phui-workpanel-view-css' => '92197373', + 'phui-workcard-view-css' => '00979e40', + 'phui-workpanel-view-css' => 'a3a63478', 'phuix-action-list-view' => 'b5c256b8', 'phuix-action-view' => '8cf6d262', 'phuix-autocomplete' => '6d86ce8b', @@ -898,7 +908,7 @@ return array( 'policy-transaction-detail-css' => '82100a43', 'ponder-view-css' => 'fbd45f96', 'project-card-view-css' => '9418c97d', - 'project-view-css' => '55d99221', + 'project-view-css' => '1e6f7072', 'releeph-core' => '9b3c5733', 'releeph-preview-branch' => 'b7a6f4a5', 'releeph-request-differential-create-dialog' => '8d8b92cd', @@ -961,6 +971,12 @@ return array( 'phabricator-prefab', 'phuix-icon-view', ), + '0825c27a' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-util', + ), '08675c6d' => array( 'javelin-behavior', 'javelin-behavior-device', @@ -1040,6 +1056,9 @@ return array( '185bbd53' => array( 'javelin-install', ), + '19f9369b' => array( + 'phui-oi-list-view-css', + ), '1aa4c968' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1522,12 +1541,6 @@ return array( 'owners-path-editor', 'javelin-behavior', ), - '7b98d7c5' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-util', - ), '7cbe244b' => array( 'javelin-install', 'javelin-util', @@ -1650,9 +1663,6 @@ return array( 'javelin-dom', 'javelin-request', ), - 92197373 => array( - 'phui-workcard-view-css', - ), '92b9ec77' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1718,6 +1728,9 @@ return array( 'javelin-workflow', 'javelin-stratcom', ), + '9d9685d6' => array( + 'phui-oi-list-view-css', + ), '9f36c42d' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1747,6 +1760,9 @@ return array( 'javelin-behavior-device', 'javelin-vector', ), + 'a3a63478' => array( + 'phui-workcard-view-css', + ), 'a464fe03' => array( 'javelin-behavior', 'javelin-uri', @@ -1762,6 +1778,9 @@ return array( 'javelin-stratcom', 'javelin-dom', ), + 'a8beebea' => array( + 'phui-oi-list-view-css', + ), 'a8d8459d' => array( 'javelin-behavior', 'javelin-dom', @@ -1980,6 +1999,9 @@ return array( 'javelin-util', 'phabricator-notification-css', ), + 'cd2b9b77' => array( + 'phui-oi-list-view-css', + ), 'd0c516d5' => array( 'javelin-behavior', 'javelin-dom', @@ -2149,6 +2171,9 @@ return array( 'f03e17be' => array( 'phui-theme-css', ), + 'f12cbc9f' => array( + 'phui-oi-list-view-css', + ), 'f2e58483' => array( 'javelin-behavior', 'javelin-dom', @@ -2285,7 +2310,12 @@ return array( 'phabricator-nav-view-css', 'phui-basic-nav-view-css', 'phui-crumbs-view-css', - 'phui-object-item-list-view-css', + 'phui-oi-list-view-css', + 'phui-oi-color-css', + 'phui-oi-big-ui-css', + 'phui-oi-drag-ui-css', + 'phui-oi-simple-ui-css', + 'phui-oi-flush-ui-css', 'global-drag-and-drop-css', 'phui-spacing-css', 'phui-form-css', diff --git a/resources/celerity/packages.php b/resources/celerity/packages.php index affa180dc1..95cf5303ef 100644 --- a/resources/celerity/packages.php +++ b/resources/celerity/packages.php @@ -117,7 +117,12 @@ return array( 'phabricator-nav-view-css', 'phui-basic-nav-view-css', 'phui-crumbs-view-css', - 'phui-object-item-list-view-css', + 'phui-oi-list-view-css', + 'phui-oi-color-css', + 'phui-oi-big-ui-css', + 'phui-oi-drag-ui-css', + 'phui-oi-simple-ui-css', + 'phui-oi-flush-ui-css', 'global-drag-and-drop-css', 'phui-spacing-css', 'phui-form-css', diff --git a/src/applications/meta/query/PhabricatorAppSearchEngine.php b/src/applications/meta/query/PhabricatorAppSearchEngine.php index 62e1c1020e..b609a8b137 100644 --- a/src/applications/meta/query/PhabricatorAppSearchEngine.php +++ b/src/applications/meta/query/PhabricatorAppSearchEngine.php @@ -201,7 +201,7 @@ final class PhabricatorAppSearchEngine $results[] = phutil_tag( 'h1', array( - 'class' => 'phui-object-item-list-header', + 'class' => 'phui-oi-list-header', ), idx($group_names, $group, $group)); } diff --git a/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php index d12db30f83..ac950eade1 100644 --- a/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php @@ -148,7 +148,8 @@ final class PhabricatorHomePreferencesSettingsPanel $list = id(new PHUIObjectItemListView()) ->setViewer($viewer) - ->setID($list_id); + ->setID($list_id) + ->setDrag(true); Javelin::initBehavior( 'reorder-applications', @@ -170,7 +171,6 @@ final class PhabricatorHomePreferencesSettingsPanel $item = id(new PHUIObjectItemView()) ->setHeader($application->getName()) ->setImageIcon($icon) - ->addAttribute($application->getShortDescription()) ->setGrippable(true); $item->addAction( diff --git a/src/view/phui/PHUIObjectItemListView.php b/src/view/phui/PHUIObjectItemListView.php index 6c81053f0a..53e86382c2 100644 --- a/src/view/phui/PHUIObjectItemListView.php +++ b/src/view/phui/PHUIObjectItemListView.php @@ -9,8 +9,9 @@ final class PHUIObjectItemListView extends AphrontTagView { private $flush; private $simple; private $big; + private $drag; private $allowEmptyList; - private $itemClass = 'phui-object-item-standard'; + private $itemClass = 'phui-oi-standard'; public function setAllowEmptyList($allow_empty_list) { $this->allowEmptyList = $allow_empty_list; @@ -46,6 +47,12 @@ final class PHUIObjectItemListView extends AphrontTagView { return $this; } + public function setDrag($drag) { + $this->drag = $drag; + $this->setItemClass('phui-oi-drag'); + return $this; + } + public function setNoDataString($no_data_string) { $this->noDataString = $no_data_string; return $this; @@ -67,16 +74,26 @@ final class PHUIObjectItemListView extends AphrontTagView { protected function getTagAttributes() { $classes = array(); + $classes[] = 'phui-oi-list-view'; - $classes[] = 'phui-object-item-list-view'; if ($this->flush) { - $classes[] = 'phui-object-list-flush'; + $classes[] = 'phui-oi-list-flush'; + require_celerity_resource('phui-oi-flush-ui-css'); } + if ($this->simple) { - $classes[] = 'phui-object-list-simple'; + $classes[] = 'phui-oi-list-simple'; + require_celerity_resource('phui-oi-simple-ui-css'); } + if ($this->big) { - $classes[] = 'phui-object-list-big'; + $classes[] = 'phui-oi-list-big'; + require_celerity_resource('phui-oi-big-ui-css'); + } + + if ($this->drag) { + $classes[] = 'phui-oi-list-drag'; + require_celerity_resource('phui-oi-drag-ui-css'); } return array( @@ -86,14 +103,15 @@ final class PHUIObjectItemListView extends AphrontTagView { protected function getTagContent() { $viewer = $this->getUser(); - require_celerity_resource('phui-object-item-list-view-css'); + require_celerity_resource('phui-oi-list-view-css'); + require_celerity_resource('phui-oi-color-css'); $header = null; if (strlen($this->header)) { $header = phutil_tag( 'h1', array( - 'class' => 'phui-object-item-list-header', + 'class' => 'phui-oi-list-header', ), $this->header); } @@ -120,7 +138,7 @@ final class PHUIObjectItemListView extends AphrontTagView { $items = phutil_tag( 'li', array( - 'class' => 'phui-object-item-empty', + 'class' => 'phui-oi-empty', ), $string); diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php index 80fe6fb4d0..6d193081d2 100644 --- a/src/view/phui/PHUIObjectItemView.php +++ b/src/view/phui/PHUIObjectItemView.php @@ -229,45 +229,45 @@ final class PHUIObjectItemView extends AphrontTagView { protected function getTagAttributes() { $item_classes = array(); - $item_classes[] = 'phui-object-item'; + $item_classes[] = 'phui-oi'; if ($this->icons) { - $item_classes[] = 'phui-object-item-with-icons'; + $item_classes[] = 'phui-oi-with-icons'; } if ($this->attributes) { - $item_classes[] = 'phui-object-item-with-attrs'; + $item_classes[] = 'phui-oi-with-attrs'; } if ($this->handleIcons) { - $item_classes[] = 'phui-object-item-with-handle-icons'; + $item_classes[] = 'phui-oi-with-handle-icons'; } if ($this->barColor) { - $item_classes[] = 'phui-object-item-bar-color-'.$this->barColor; + $item_classes[] = 'phui-oi-bar-color-'.$this->barColor; } else { - $item_classes[] = 'phui-object-item-no-bar'; + $item_classes[] = 'phui-oi-no-bar'; } if ($this->actions) { $n = count($this->actions); - $item_classes[] = 'phui-object-item-with-actions'; - $item_classes[] = 'phui-object-item-with-'.$n.'-actions'; + $item_classes[] = 'phui-oi-with-actions'; + $item_classes[] = 'phui-oi-with-'.$n.'-actions'; } if ($this->disabled) { - $item_classes[] = 'phui-object-item-disabled'; + $item_classes[] = 'phui-oi-disabled'; } switch ($this->effect) { case 'highlighted': - $item_classes[] = 'phui-object-item-highlighted'; + $item_classes[] = 'phui-oi-highlighted'; break; case 'selected': - $item_classes[] = 'phui-object-item-selected'; + $item_classes[] = 'phui-oi-selected'; break; case 'visited': - $item_classes[] = 'phui-object-item-visited'; + $item_classes[] = 'phui-oi-visited'; break; case null: break; @@ -276,15 +276,15 @@ final class PHUIObjectItemView extends AphrontTagView { } if ($this->getGrippable()) { - $item_classes[] = 'phui-object-item-grippable'; + $item_classes[] = 'phui-oi-grippable'; } if ($this->getImageURI()) { - $item_classes[] = 'phui-object-item-with-image'; + $item_classes[] = 'phui-oi-with-image'; } if ($this->getImageIcon()) { - $item_classes[] = 'phui-object-item-with-image-icon'; + $item_classes[] = 'phui-oi-with-image-icon'; } return array( @@ -296,7 +296,7 @@ final class PHUIObjectItemView extends AphrontTagView { $viewer = $this->getUser(); $content_classes = array(); - $content_classes[] = 'phui-object-item-content'; + $content_classes[] = 'phui-oi-content'; $header_name = array(); @@ -311,7 +311,7 @@ final class PHUIObjectItemView extends AphrontTagView { phutil_tag( 'span', array( - 'class' => 'phui-object-item-objname', + 'class' => 'phui-oi-objname', ), $this->objectName), ' ', @@ -329,7 +329,7 @@ final class PHUIObjectItemView extends AphrontTagView { $this->href ? 'a' : 'div', array( 'href' => $this->href, - 'class' => 'phui-object-item-link', + 'class' => 'phui-oi-link', 'title' => $title_text, ), $this->header); @@ -340,7 +340,7 @@ final class PHUIObjectItemView extends AphrontTagView { $header = phutil_tag( 'div', array( - 'class' => 'phui-object-item-name', + 'class' => 'phui-oi-name', ), javelin_tag( 'span', @@ -360,7 +360,7 @@ final class PHUIObjectItemView extends AphrontTagView { $icon = $spec['icon']; $icon = id(new PHUIIconView()) ->setIcon($icon) - ->addClass('phui-object-item-icon-image'); + ->addClass('phui-oi-icon-image'); if (isset($spec['attributes']['tip'])) { $sigil = 'has-tooltip'; @@ -375,7 +375,7 @@ final class PHUIObjectItemView extends AphrontTagView { $label = phutil_tag( 'span', array( - 'class' => 'phui-object-item-icon-label', + 'class' => 'phui-oi-icon-label', ), $spec['label']); @@ -389,7 +389,7 @@ final class PHUIObjectItemView extends AphrontTagView { } $classes = array(); - $classes[] = 'phui-object-item-icon'; + $classes[] = 'phui-oi-icon'; if (isset($spec['attributes']['class'])) { $classes[] = $spec['attributes']['class']; } @@ -405,7 +405,7 @@ final class PHUIObjectItemView extends AphrontTagView { $icons[] = phutil_tag( 'ul', array( - 'class' => 'phui-object-item-icons', + 'class' => 'phui-oi-icons', ), $icon_list); } @@ -420,7 +420,7 @@ final class PHUIObjectItemView extends AphrontTagView { $handle_bar = phutil_tag( 'li', array( - 'class' => 'phui-object-item-handle-icons', + 'class' => 'phui-oi-handle-icons', ), $handle_bar); } @@ -431,14 +431,14 @@ final class PHUIObjectItemView extends AphrontTagView { $bylines[] = phutil_tag( 'div', array( - 'class' => 'phui-object-item-byline', + 'class' => 'phui-oi-byline', ), $byline); } $bylines = phutil_tag( 'div', array( - 'class' => 'phui-object-item-bylines', + 'class' => 'phui-oi-bylines', ), $bylines); } @@ -448,7 +448,7 @@ final class PHUIObjectItemView extends AphrontTagView { $subhead = phutil_tag( 'div', array( - 'class' => 'phui-object-item-subhead', + 'class' => 'phui-oi-subhead', ), $this->subhead); } @@ -468,7 +468,7 @@ final class PHUIObjectItemView extends AphrontTagView { $spacer = phutil_tag( 'span', array( - 'class' => 'phui-object-item-attribute-spacer', + 'class' => 'phui-oi-attribute-spacer', ), "\xC2\xB7"); $first = true; @@ -476,7 +476,7 @@ final class PHUIObjectItemView extends AphrontTagView { $attrs[] = phutil_tag( 'li', array( - 'class' => 'phui-object-item-attribute', + 'class' => 'phui-oi-attribute', ), array( ($first ? null : $spacer), @@ -488,7 +488,7 @@ final class PHUIObjectItemView extends AphrontTagView { $attrs = phutil_tag( 'ul', array( - 'class' => 'phui-object-item-attributes', + 'class' => 'phui-oi-attributes', ), array( $handle_bar, @@ -507,7 +507,7 @@ final class PHUIObjectItemView extends AphrontTagView { $grippable = phutil_tag( 'div', array( - 'class' => 'phui-object-item-grip', + 'class' => 'phui-oi-grip', ), ''); } @@ -528,7 +528,7 @@ final class PHUIObjectItemView extends AphrontTagView { $image = phutil_tag( 'div', array( - 'class' => 'phui-object-item-image', + 'class' => 'phui-oi-image', 'style' => 'background-image: url('.$this->getImageURI().')', ), ''); @@ -536,7 +536,7 @@ final class PHUIObjectItemView extends AphrontTagView { $image = phutil_tag( 'div', array( - 'class' => 'phui-object-item-image-icon', + 'class' => 'phui-oi-image-icon', ), $this->getImageIcon()); } @@ -556,7 +556,7 @@ final class PHUIObjectItemView extends AphrontTagView { $column0 = phutil_tag( 'div', array( - 'class' => 'phui-object-item-col0', + 'class' => 'phui-oi-col0', ), $status); } @@ -565,7 +565,7 @@ final class PHUIObjectItemView extends AphrontTagView { $column0 = phutil_tag( 'div', array( - 'class' => 'phui-object-item-col0 phui-object-item-badge', + 'class' => 'phui-oi-col0 phui-oi-badge', ), $this->badge); } @@ -574,7 +574,7 @@ final class PHUIObjectItemView extends AphrontTagView { $countdown = phutil_tag( 'div', array( - 'class' => 'phui-object-item-countdown-number', + 'class' => 'phui-oi-countdown-number', ), array( phutil_tag_div('', $this->countdownNum), @@ -583,7 +583,7 @@ final class PHUIObjectItemView extends AphrontTagView { $column0 = phutil_tag( 'div', array( - 'class' => 'phui-object-item-col0 phui-object-item-countdown', + 'class' => 'phui-oi-col0 phui-oi-countdown', ), $countdown); } @@ -591,7 +591,7 @@ final class PHUIObjectItemView extends AphrontTagView { $column1 = phutil_tag( 'div', array( - 'class' => 'phui-object-item-col1', + 'class' => 'phui-oi-col1', ), array( $header, @@ -603,7 +603,7 @@ final class PHUIObjectItemView extends AphrontTagView { $column2 = phutil_tag( 'div', array( - 'class' => 'phui-object-item-col2', + 'class' => 'phui-oi-col2', ), array( $icons, @@ -615,7 +615,7 @@ final class PHUIObjectItemView extends AphrontTagView { $column2 = phutil_tag( 'div', array( - 'class' => 'phui-object-item-col2 phui-object-item-launch-button', + 'class' => 'phui-oi-col2 phui-oi-launch-button', ), array( $this->launchButton, @@ -625,10 +625,10 @@ final class PHUIObjectItemView extends AphrontTagView { $table = phutil_tag( 'div', array( - 'class' => 'phui-object-item-table', + 'class' => 'phui-oi-table', ), phutil_tag_div( - 'phui-object-item-table-row', + 'phui-oi-table-row', array( $column0, $column1, @@ -638,7 +638,7 @@ final class PHUIObjectItemView extends AphrontTagView { $box = phutil_tag( 'div', array( - 'class' => 'phui-object-item-content-box', + 'class' => 'phui-oi-content-box', ), array( $grippable, @@ -656,7 +656,7 @@ final class PHUIObjectItemView extends AphrontTagView { $actions = phutil_tag( 'ul', array( - 'class' => 'phui-object-item-actions', + 'class' => 'phui-oi-actions', ), $actions); } @@ -664,7 +664,7 @@ final class PHUIObjectItemView extends AphrontTagView { $frame_content = phutil_tag( 'div', array( - 'class' => 'phui-object-item-frame-content', + 'class' => 'phui-oi-frame-content', ), array( $actions, @@ -678,13 +678,13 @@ final class PHUIObjectItemView extends AphrontTagView { 'img', array( 'src' => $this->coverImage, - 'class' => 'phui-object-item-cover-image', + 'class' => 'phui-oi-cover-image', )); $frame_cover = phutil_tag( 'div', array( - 'class' => 'phui-object-item-frame-cover', + 'class' => 'phui-oi-frame-cover', ), $cover_image); } @@ -692,7 +692,7 @@ final class PHUIObjectItemView extends AphrontTagView { $frame = phutil_tag( 'div', array( - 'class' => 'phui-object-item-frame', + 'class' => 'phui-oi-frame', ), array( $frame_cover, @@ -709,7 +709,7 @@ final class PHUIObjectItemView extends AphrontTagView { ->setIcon($icon); $options = array( - 'class' => 'phui-object-item-status-icon', + 'class' => 'phui-oi-status-icon', ); if (strlen($label)) { @@ -725,7 +725,7 @@ final class PHUIObjectItemView extends AphrontTagView { Javelin::initBehavior('phabricator-tooltips'); $options = array( - 'class' => 'phui-object-item-handle-icon', + 'class' => 'phui-oi-handle-icon', 'style' => 'background-image: url('.$handle->getImageURI().')', ); diff --git a/webroot/rsrc/css/aphront/dialog-view.css b/webroot/rsrc/css/aphront/dialog-view.css index 9cf56394df..3b2de1cee6 100644 --- a/webroot/rsrc/css/aphront/dialog-view.css +++ b/webroot/rsrc/css/aphront/dialog-view.css @@ -158,18 +158,18 @@ margin-top: 16px; } -.device-desktop .aphront-dialog-flush .phui-object-item-list-view { +.device-desktop .aphront-dialog-flush .phui-oi-list-view { margin: 0; padding: 0; } -.aphront-dialog-flush .phui-object-item-list-view.phui-object-list-stackable - .phui-object-item { +.aphront-dialog-flush .phui-oi-list-view.phui-object-list-stackable + .phui-oi { border: 0; } -.aphront-dialog-flush .phui-object-item-list-view.phui-object-list-stackable - .phui-object-item-frame { +.aphront-dialog-flush .phui-oi-list-view.phui-object-list-stackable + .phui-oi-frame { border: 0; border-top: 1px solid {$thinblueborder}; } diff --git a/webroot/rsrc/css/application/config/config-page.css b/webroot/rsrc/css/application/config/config-page.css index 5fe15aadb8..82cb9642d2 100644 --- a/webroot/rsrc/css/application/config/config-page.css +++ b/webroot/rsrc/css/application/config/config-page.css @@ -39,7 +39,7 @@ margin: 0 4px; } -.device-desktop .config-page-content .phui-object-item-list-view { +.device-desktop .config-page-content .phui-oi-list-view { padding-left: 0; padding-right: 0; } diff --git a/webroot/rsrc/css/application/flag/flag.css b/webroot/rsrc/css/application/flag/flag.css index 8f6f7a45e8..7d5f0af5d2 100644 --- a/webroot/rsrc/css/application/flag/flag.css +++ b/webroot/rsrc/css/application/flag/flag.css @@ -7,7 +7,7 @@ background: transparent 0 0 no-repeat; } -.phui-object-item .phabricator-flag-icon { +.phui-oi .phabricator-flag-icon { float: left; margin: 2px; margin-right: 8px; diff --git a/webroot/rsrc/css/application/project/project-view.css b/webroot/rsrc/css/application/project/project-view.css index 7fc3001d80..5b72e1c9eb 100644 --- a/webroot/rsrc/css/application/project/project-view.css +++ b/webroot/rsrc/css/application/project/project-view.css @@ -72,7 +72,7 @@ margin-bottom: 0; } -.project-view-home .phui-box-grey .phui-object-item-list-view { +.project-view-home .phui-box-grey .phui-oi-list-view { padding: 4px 8px 0 8px; } @@ -80,7 +80,7 @@ background-color: #fff; } -.project-view-home .phui-box-grey .phui-object-item-attribute .phui-icon-view { +.project-view-home .phui-box-grey .phui-oi-attribute .phui-icon-view { color: {$lightgreytext}; } diff --git a/webroot/rsrc/css/application/search/search-results.css b/webroot/rsrc/css/application/search/search-results.css index f02efe1315..734d86c029 100644 --- a/webroot/rsrc/css/application/search/search-results.css +++ b/webroot/rsrc/css/application/search/search-results.css @@ -2,7 +2,7 @@ * @provides phabricator-search-results-css */ -.phui-object-item-link strong { +.phui-oi-link strong { color: {$fire}; text-decoration: underline; } diff --git a/webroot/rsrc/css/layout/phabricator-source-code-view.css b/webroot/rsrc/css/layout/phabricator-source-code-view.css index 4bd57fcfcb..7e956b580a 100644 --- a/webroot/rsrc/css/layout/phabricator-source-code-view.css +++ b/webroot/rsrc/css/layout/phabricator-source-code-view.css @@ -10,7 +10,7 @@ background-color: #FFFEF5; } -.phui-object-item .phabricator-source-code-container { +.phui-oi .phabricator-source-code-container { margin-left: 8px; } diff --git a/webroot/rsrc/css/phui/object-item/phui-oi-big-ui.css b/webroot/rsrc/css/phui/object-item/phui-oi-big-ui.css new file mode 100644 index 0000000000..7fcc6d4ef7 --- /dev/null +++ b/webroot/rsrc/css/phui/object-item/phui-oi-big-ui.css @@ -0,0 +1,48 @@ +/** + * @provides phui-oi-big-ui-css + * @requires phui-oi-list-view-css + */ + +.phui-oi-list-big ul.phui-oi-list-view { + margin: 0; + padding: 20px; +} + +.phui-oi-list-big .phui-oi-no-bar .phui-oi-frame { + border: 0; +} + +.phui-oi-list-big .phui-oi-image-icon { + margin: 8px 2px 12px; +} + +.phui-oi-list-big a.phui-oi-link { + color: #000; + font-size: {$biggestfontsize}; +} + +.phui-oi-list-big .phui-oi-name { + padding-top: 6px; +} + +.phui-oi-list-big .phui-oi-launch-button a.button { + font-size: {$normalfontsize}; + padding: 3px 12px 4px; +} + +.device-desktop .phui-oi-list-big .phui-oi { + margin-bottom: 8px; +} + +.phui-oi-list-big .phui-oi-col0 { + vertical-align: top; + padding: 0; +} + +.phui-oi-list-big .phui-oi-status-icon { + padding: 5px; +} + +.phui-oi-list-big .phui-oi-visited a.phui-oi-link { + color: {$violet}; +} diff --git a/webroot/rsrc/css/phui/object-item/phui-oi-color.css b/webroot/rsrc/css/phui/object-item/phui-oi-color.css new file mode 100644 index 0000000000..e9ec630727 --- /dev/null +++ b/webroot/rsrc/css/phui/object-item/phui-oi-color.css @@ -0,0 +1,68 @@ +/** + * @provides phui-oi-color-css + * @requires phui-oi-list-view-css + */ + + +/* - Bar Colors ---------------------------------------------------------------- + Colors for the left-hand border bars, used to indicate object status or other + attributes. +*/ + +.phui-oi-bar-color-red { + border-left-color: {$red}; +} + +.phui-oi-bar-color-orange { + border-left-color: {$orange}; +} + +.phui-oi-bar-color-yellow { + border-left-color: {$yellow}; +} + +.phui-oi-bar-color-green { + border-left-color: {$green}; +} + +.phui-oi-bar-color-sky { + border-left-color: {$sky}; +} + +.phui-oi-bar-color-blue { + border-left-color: {$blue}; +} + +.phui-oi-bar-color-indigo { + border-left-color: {$indigo}; +} + +.phui-oi-bar-color-violet { + border-left-color: {$violet}; +} + +.phui-oi-bar-color-pink { + border-left-color: {$pink}; +} + +.phui-oi-bar-color-fire { + border-left-color: {$fire}; +} + +.phui-oi-bar-color-bluegrey { + border-left-color: {$bluetext}; +} + +.phui-oi-bar-color-lightbluetext { + border-left-color: {$lightbluetext}; +} + +.phui-oi-bar-color-grey, +.phui-oi-bar-color-lightgreytext { + border-left-color: {$lightgreytext}; +} + +.phui-oi-bar-color-black, +.phui-oi-bar-color-dark { + border-left-color: {$darkgreytext}; +} diff --git a/webroot/rsrc/css/phui/object-item/phui-oi-drag-ui.css b/webroot/rsrc/css/phui/object-item/phui-oi-drag-ui.css new file mode 100644 index 0000000000..caf9ff8dd0 --- /dev/null +++ b/webroot/rsrc/css/phui/object-item/phui-oi-drag-ui.css @@ -0,0 +1,59 @@ +/** + * @provides phui-oi-drag-ui-css + * @requires phui-oi-list-view-css + */ + +.phui-object-box .phui-oi-list-view.phui-oi-list-drag { + margin-top: 8px; + margin-bottom: 4px; +} + +.phui-oi.phui-oi-drag { + background: {$bluebackground}; + border-radius: 3px; + border: none; +} + +.phui-oi.phui-oi-drag, +.phui-oi.phui-oi-drag .phui-oi-frame { + border: none; +} + +.phui-object-box .phui-oi-list-view .phui-oi.phui-oi-drag { + margin-top: 4px; +} + +.phui-oi-drag.phui-oi-with-image-icon .phui-oi-frame, +.phui-oi-drag.phui-oi-with-image .phui-oi-frame, +.phui-oi-drag .phui-oi-frame { + min-height: 36px; +} + +.phui-oi-drag .phui-oi-list-icon { + height: auto; + width: auto; +} + +.phui-oi-drag .phui-oi-image-icon .phui-icon-view { + height: 16px; + width: 16px; + font-size: 16px; + line-height: 20px; +} + +.phui-oi-drag.phui-oi-grippable .phui-oi-frame { + padding-left: 28px; +} + +.phui-oi-drag .phui-oi-grip { + left: 4px; +} + +.phui-oi-drag.phui-oi-with-image-icon .phui-oi-content-box, +.phui-oi-drag.phui-oi-with-image .phui-oi-content-box { + margin-left: 24px; +} + +.phui-oi-list-drag .drag-ghost { + margin-top: 4px; +} diff --git a/webroot/rsrc/css/phui/object-item/phui-oi-flush-ui.css b/webroot/rsrc/css/phui/object-item/phui-oi-flush-ui.css new file mode 100644 index 0000000000..2902cb22ce --- /dev/null +++ b/webroot/rsrc/css/phui/object-item/phui-oi-flush-ui.css @@ -0,0 +1,13 @@ +/** + * @provides phui-oi-flush-ui-css + * @requires phui-oi-list-view-css + */ + +.phui-oi-list-view.phui-oi-list-flush { + padding: 0; + margin: 0; +} + +.phui-object-box .phui-oi-list-flush .phui-oi { + margin: 0; +} diff --git a/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css b/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css new file mode 100644 index 0000000000..018245e21c --- /dev/null +++ b/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css @@ -0,0 +1,625 @@ +/** + * @provides phui-oi-list-view-css + */ + +.phui-oi { + border-left-width: 0; +} + +ul.phui-oi-list-view { + padding: 8px; + list-style: none; +} + +.device-desktop .phui-oi-list-view { + padding: 16px; +} + +.phui-oi-list-view + .phui-oi-list-view { + padding-top: 0; +} + +.phui-object-box .phui-oi-list-view .phui-oi { + margin: 0; +} + +.phui-oi-list-view .phui-info-view { + margin: 0; +} + +.phui-object-box .phui-oi-list-view .phui-info-view { + color: {$greytext}; + border: none; +} + +.phui-oi { + border-style: solid; + border-color: {$lightgreyborder}; + margin: 5px 0; + overflow: hidden; + background: #fff; + margin-bottom: 4px; +} + +.phui-oi .phui-icon-view { + display: inline-block; +} + +.phui-oi-frame { + border-color: {$lightblueborder}; + border-width: 1px 1px 1px 0; + border-style: solid; + position: relative; + min-height: 33px; + overflow: hidden; +} + +.phui-oi-cover-image { + display: none; +} + +.phui-oi-no-bar .phui-oi-frame { + border-width: 1px; +} + +.device-desktop .phui-oi { + margin: 0 0 4px 0; +} + +.phui-object-box .phui-oi-list-view { + margin: 0; +} + +.phui-oi-status-icon { + font-weight: bold; + padding: 3px; + font-size: 16px; +} + +.phui-oi-list-view .phui-oi-col0 .phui-icon-view { + width: 17px; + text-align: center; + overflow: visible; + position: relative; + left: -1px; +} + +.phui-oi-name { + padding: 8px 8px 0; + white-space: nowrap; + word-wrap: break-word; + overflow: hidden; + text-overflow: ellipsis; + font-weight: bold; + -webkit-font-smoothing: antialiased; +} + +.device-phone .phui-oi-name { + overflow: normal; + white-space: normal; + font-weight: bold; +} + +.phui-oi-link { + display: inline; +} + +.phui-oi-objname { + color: #000; + cursor: text; + font-weight: bold; +} + +.phui-oi-content { + margin: 4px 8px 2px 0; + overflow: hidden; +} + +.phui-oi-grippable { + cursor: move; +} + +.device .phui-oi-grippable { + cursor: normal; +} + +.phui-oi-grip { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 20px; + background: url('/rsrc/image/texture/grip.png') center center no-repeat; +} + +.device .phui-oi-grip { + display: none; +} + +.phui-oi-grippable .phui-oi-frame { + padding-left: 16px; +} + +.device .phui-oi-grippable .phui-oi-frame { + padding-left: 0; +} + +.phui-oi-list-header { + padding: 0 0 8px 0; + color: {$darkgreytext}; +} + +.phui-oi-table { + display: table; + table-layout: fixed; + width: 100%; +} + +.phui-oi-table-row { + display: table-row; +} + +.phui-oi-col0 { + width: 20px; + display: table-cell; + vertical-align: middle; + padding-left: 4px; +} + +.device-phone .phui-oi-col0 { + vertical-align: top; + padding-top: 8px; +} + +.phui-oi-col1 { + display: table-cell; + vertical-align: top; +} + +.phui-oi-col2 { + width: 160px; + display: table-cell; + vertical-align: top; +} + +.device-phone .phui-oi-col1, +.device-phone .phui-oi-col2 { + display: block; + width: auto; +} + +/* - Item Actions -------------------------------------------------------------- + + Action buttons, like "Edit" and "Delete". + +*/ + +.phui-oi-actions { + position: absolute; + right: 4px; + top: 4px; + bottom: 4px; + vertical-align: middle; + text-align: right; +} + +.phui-oi-actions .phui-list-item-view { + float: right; + height: 100%; + width: 24px; + display: inline-block; + position: relative; +} + +.phui-oi-actions .phui-list-item-href { + display: inline-block; + position: relative; + width: 24px; + height: 100%; +} + +.device-desktop .phui-oi-actions .phui-list-item-href:hover { + background: {$hoverblue}; + border-radius: 3px; +} + +.phui-oi-actions .phui-list-item-icon { + width: 14px; + height: 14px; + position: absolute; + display: block; + top: 50%; + margin-top: -7px; + left: 3px; +} + +.phui-oi-actions .phui-list-item-name { + display: none; +} + +.phui-oi-with-1-actions .phui-oi-content-box { + margin-right: 28px; + overflow: hidden; +} + +.phui-oi-with-2-actions .phui-oi-content-box { + margin-right: 54px; + overflow: hidden; +} + +.phui-oi-with-3-actions .phui-oi-content-box { + margin-right: 76px; + overflow: hidden; +} + + +/* - Object Box List ----------------------------------------------------------- + + Tighter, stacking list when inside an Object Box + +*/ + +.phui-object-box .phui-oi-list-view { + padding: 0; + border: none; +} + +.phui-object-box .phui-oi-frame { + border-right: none; +} + +.phui-object-box .phui-oi:last-child + .phui-oi-frame { + border-bottom: none; +} + + +/* - Subhead ------------------------------------------------------------------- + + Descriptive Text or Links under the main header, before attributes. + +*/ + +.phui-oi-subhead { + color: {$greytext}; + padding: 0 8px 6px; +} + + +/* - Attribute List ------------------------------------------------------------ + + Object attributes, commonly used to render created date, etc. + +*/ + +.phui-oi-attributes { + padding: 0 8px 6px; + line-height: 18px; + min-height: 21px; +} + +.phui-oi-attribute { + display: inline-block; + color: {$greytext}; + vertical-align: top; +} + +.phui-oi-attribute-spacer { + padding: 0 4px; +} + + +/* - Icons --------------------------------------------------------------------- + + Icons, which show object state. On mobile, they are rendered without labels + to save space. + +*/ + +.phui-object-icon-pane { + margin: 8px 0 4px; +} + +.device-phone .phui-object-icon-pane { + margin: 0 0 4px; +} + +.phui-oi-icons { + padding: 0 4px 0 0; +} + +.device-phone .phui-oi-icons { + padding: 0 0 0 8px; +} + +ul.phui-oi-icons { + margin: 0; +} + +.phui-oi-icon { + vertical-align: middle; + font-size: {$smallerfontsize}; + color: {$greytext}; + text-align: right; + white-space: nowrap; + overflow: hidden; + min-height: 18px; + line-height: 18px; +} + +.device-phone .phui-oi-icon { + text-align: left; + font-size: 13px; +} + +/* + * Items with icon 'none' still have on mobile, thus creating a weird vertical + * margin for elements which follow + */ +.device-phone .phui-oi-icon .none { + display: none; +} + +.phui-oi-icon-image { + width: 14px; + height: 14px; + font-size: 13px; + margin-right: 4px; +} + + +/* - Disabled ------------------------------------------------------------------ + + Disabled/inactive objects. + +*/ + + +.phui-oi.phui-oi-disabled .phui-oi-link, +.phui-oi.phui-oi-disabled .phui-oi-link a { + color: {$lightgreytext}; +} + +.phui-oi.phui-oi-disabled .phui-oi-frame { + border-color: #d7d7d7; +} + +.phui-oi.phui-oi-disabled .phui-oi-objname { + color: {$greytext}; + text-decoration: line-through; +} + + +/* - Effects ------------------------------------------------------------------- + + Effects like highlighted items. + +*/ + +.phui-oi.phui-oi-highlighted { + background: {$sh-yellowbackground}; +} + +ul.phui-oi-list-view .phui-oi-highlighted + .phui-oi-frame { + border-color: {$sh-yellowborder}; +} + +.phui-oi-selected { + background: {$sh-bluebackground}; +} + +ul.phui-oi-list-view .phui-oi-selected + .phui-oi-frame { + border-color: {$sh-blueborder}; +} + + +/* - Handle Icons -------------------------------------------------------------- + + Shows owners, reviewers, etc., using profile picture icons. + +*/ + +.phui-oi-handle-icons { + bottom: 0; + right: 4px; + position: absolute; +} + +.phui-oi-handle-icon { + width: 24px; + height: 24px; + display: inline-block; + background-size: 100%; + border-radius: 3px; + background-repeat: no-repeat; +} + + +/* - Bylines ------------------------------------------------------------------- + + Shows owners, authors, reviewers, etc., in text. + +*/ + +.phui-oi-bylines { + padding: 0 4px 0 8px; + margin: 4px 0 8px; + font-size: {$smallerfontsize}; + color: {$greytext}; + text-align: right; +} + +.phui-oi-byline { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.device-phone .phui-oi-bylines { + float: none; + text-align: left; + padding: 0 8px; + font-size: {$normalfontsize}; +} + + +/* - Draggable List ------------------------------------------------------------ + + These classes are applied by and/or provided for use with JX.DraggableList. + +*/ + +.drag-ghost { + position: relative; + background: {$sh-indigobackground}; + border-radius: 3px; + margin-bottom: 4px; + border: 1px dashed {$sh-indigoborder}; +} + +.drag-dragging { + opacity: 0.25; +} + +.drag-sending { + opacity: 0.5; +} + +.drag-clone, +.drag-frame { + /* This allows mousewheel events to pass through the clone and frame while + they are being dragged. Without this, the mousewheel does not work during + a drag operation. */ + pointer-events: none; +} + +.drag-frame { + position: fixed; + overflow: hidden; + left: 0; + right: 0; + top: 0; + bottom: 0; +} + +.drag-clone { + position: absolute; + list-style: none; +} + +/* - Badges ---------------------------------------------------------------- */ + +.phui-oi-col0.phui-oi-badge { + width: 28px; +} + +.phui-oi-col0.phui-oi-badge .phui-icon-view { + left: 0; +} + +/* - Countdowns ------------------------------------------------------------ */ + +.phui-oi-col0.phui-oi-countdown { + width: 52px; + padding: 0; +} + +.phui-oi-countdown .phui-oi-countdown-number { + border-right: 1px solid {$thinblueborder}; + text-align: center; + color: {$bluetext}; +} + + +/* - Dashboards ------------------------------------------------------------ */ + +.phui-object-box .phui-oi-list-view .phui-oi-frame { + border: none; + border-bottom: 1px solid {$thinblueborder}; +} + +.drag-clone.phui-oi-standard .phui-oi-frame { + border: none; + opacity: 0.8; + background: {$sh-bluebackground}; +} + +.phui-object-box .phui-oi-list-header { + font-size: {$normalfontsize}; + color: {$darkbluetext}; + border-top: 1px solid {$thinblueborder}; + border-bottom: 1px solid {$thinblueborder}; + padding: 8px; + background-color: {$lightgreybackground}; +} + +.phui-object-box .phui-header-shell + .phui-oi-list-view .phui-oi-list-header, +.phui-object-box .phui-object-box-hidden-content + .phui-oi-list-view + .phui-oi-list-header, +.phui-object-box .phui-object-box-hidden-content + .phui-oi-list-header { + border-top: none; + } + +.dashboard-pane .phui-oi-empty .phui-info-view { + border: none; + margin: 0; +} + +.device-desktop .aphront-multi-column-fluid .aphront-multi-column-2-up + .aphront-multi-column-column-outer.third .phui-oi-col2 { + display: none; + } + + +/* - Launcher List ---------------------------------------------------------- */ + +.phui-oi-image-icon { + background: none; + width: 40px; + height: 40px; + margin: 8px 6px; + position: absolute; +} + +.phui-oi-image-icon .phui-icon-view { + position: absolute; + width: 40px; + height: 40px; + font-size: 26px; + text-align: center; + line-height: 36px; +} + +.phui-oi-image { + width: 40px; + height: 40px; + border-radius: 3px; + background-size: 100%; + margin: 8px 6px; + position: absolute; +} + +.phui-oi-with-image-icon .phui-oi-frame, +.phui-oi-with-image .phui-oi-frame { + min-height: 52px; +} + +.phui-oi-with-image-icon .phui-oi-content-box, +.phui-oi-with-image .phui-oi-content-box { + margin-left: 46px; +} + +/* - Launcher Button -------------------------------------------------------- */ + +.phui-oi-col2.phui-oi-launch-button { + text-align: right; + vertical-align: middle; + padding-right: 4px; +} + +.device-phone .phui-oi-col2.phui-oi-launch-button { + padding: 0 8px 8px; + text-align: left; +} diff --git a/webroot/rsrc/css/phui/object-item/phui-oi-simple-ui.css b/webroot/rsrc/css/phui/object-item/phui-oi-simple-ui.css new file mode 100644 index 0000000000..e838f1ce3e --- /dev/null +++ b/webroot/rsrc/css/phui/object-item/phui-oi-simple-ui.css @@ -0,0 +1,43 @@ +/** + * @provides phui-oi-simple-ui-css + * @requires phui-oi-list-view-css + */ + +.phui-oi-list-simple .phui-oi-with-image .phui-oi-frame { + min-height: 26px; +} + +.phui-oi-list-simple .phui-oi-image { + height: 26px; + width: 26px; + margin: 0; +} + +.phui-oi-list-simple .phui-oi-with-image + .phui-oi-content-box { + margin-left: 32px; +} + +.phui-oi-list-simple .phui-oi-name { + padding: 2px 0; +} + +.phui-oi-list-simple .phui-oi-name a { + color: {$darkbluetext}; +} + +.phui-oi-list-view.phui-oi-list-simple .phui-oi-frame { + border: none; + margin-bottom: 4px; +} + +.phui-oi-list-view.phui-oi-list-simple li:last-child + .phui-oi-frame { + margin: 0; +} + +.phui-oi-list-simple .phui-oi-actions { + top: 2px; + bottom: 2px; + right: 2px; +} diff --git a/webroot/rsrc/css/phui/phui-box.css b/webroot/rsrc/css/phui/phui-box.css index 8d2acd0069..ef0816f826 100644 --- a/webroot/rsrc/css/phui/phui-box.css +++ b/webroot/rsrc/css/phui/phui-box.css @@ -24,18 +24,18 @@ border-color: {$thinblueborder}; } -.phui-box-blue .phui-object-item, -.phui-box-grey .phui-object-item { +.phui-box-blue .phui-oi, +.phui-box-grey .phui-oi { background: transparent; } -.phui-box-blue .phui-object-item-link, -.phui-box-grey .phui-object-item-link { +.phui-box-blue .phui-oi-link, +.phui-box-grey .phui-oi-link { color: {$darkbluetext}; } -.phui-box-blue .phui-object-item-list-view, -.phui-box-grey .phui-object-item-list-view { +.phui-box-blue .phui-oi-list-view, +.phui-box-grey .phui-oi-list-view { background-color: #fff; } @@ -98,7 +98,7 @@ body.device .phui-box-blue-property.phui-object-box.phui-object-box-collapsed color: {$bluetext}; } -.phui-box-blue-property .phui-object-item-list-view { +.phui-box-blue-property .phui-oi-list-view { padding: 2px 8px; } diff --git a/webroot/rsrc/css/phui/phui-crumbs-view.css b/webroot/rsrc/css/phui/phui-crumbs-view.css index 3cf8013723..d2d0744819 100644 --- a/webroot/rsrc/css/phui/phui-crumbs-view.css +++ b/webroot/rsrc/css/phui/phui-crumbs-view.css @@ -119,7 +119,7 @@ body .phui-crumbs-view + .phui-object-box { margin-top: 0; } -body .phui-crumbs-view + .phui-object-item-list-view { +body .phui-crumbs-view + .phui-oi-list-view { padding-top: 0; } diff --git a/webroot/rsrc/css/phui/phui-object-item-list-view.css b/webroot/rsrc/css/phui/phui-object-item-list-view.css deleted file mode 100644 index 2f77102f42..0000000000 --- a/webroot/rsrc/css/phui/phui-object-item-list-view.css +++ /dev/null @@ -1,790 +0,0 @@ -/** - * @provides phui-object-item-list-view-css - */ - -ul.phui-object-item-list-view { - padding: 8px; - list-style: none; -} - -.device-desktop .phui-object-item-list-view { - padding: 16px; -} - -.phui-object-item-list-view + .phui-object-item-list-view { - padding-top: 0; -} - -.phui-object-item-list-view.phui-object-list-flush { - padding: 0; - margin: 0; -} - -.phui-object-box .phui-object-item-list-view .phui-object-item { - margin: 0; -} - -.phui-object-item-list-view .phui-info-view { - margin: 0; -} - -.phui-object-box .phui-object-item-list-view .phui-info-view { - color: {$greytext}; - border: none; -} - -.phui-object-item { - border-style: solid; - border-color: {$lightgreyborder}; - margin: 5px 0; - overflow: hidden; - background: #fff; - margin-bottom: 4px; -} - -.phui-object-item .phui-icon-view { - display: inline-block; -} - -.phui-object-item-frame { - border-color: {$lightblueborder}; - border-width: 1px 1px 1px 0; - border-style: solid; - position: relative; - min-height: 33px; - overflow: hidden; -} - -.phui-object-item-cover-image { - display: none; -} - -.phui-object-item-no-bar .phui-object-item-frame { - border-width: 1px; -} - -.device-desktop .phui-object-item { - margin: 0 0 4px 0; -} - -.phui-object-box .phui-object-list-flush .phui-object-item { - margin: 0; -} - -.phui-object-box .phui-object-item-list-view { - margin: 0; -} - -.phui-object-item-status-icon { - font-weight: bold; - padding: 3px; - font-size: 16px; -} - -.phui-object-item-list-view .phui-object-item-col0 .phui-icon-view { - width: 17px; - text-align: center; - overflow: visible; - position: relative; - left: -1px; -} - -.phui-object-item-name { - padding: 8px 8px 0; - white-space: nowrap; - word-wrap: break-word; - overflow: hidden; - text-overflow: ellipsis; - font-weight: bold; - -webkit-font-smoothing: antialiased; -} - -.device-phone .phui-object-item-name { - overflow: normal; - white-space: normal; - font-weight: bold; -} - -.phui-object-item-link { - display: inline; -} - -.phui-object-item-objname { - color: #000; - cursor: text; - font-weight: bold; -} - -.phui-object-item-content { - margin: 4px 8px 2px 0; - overflow: hidden; -} - -.phui-object-item-grippable { - cursor: move; -} - -.device .phui-object-item-grippable { - cursor: normal; -} - -.phui-object-item-grip { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 20px; - background: url('/rsrc/image/texture/grip.png') center center no-repeat; -} - -.device .phui-object-item-grip { - display: none; -} - -.phui-object-item-grippable .phui-object-item-frame { - padding-left: 16px; -} - -.device .phui-object-item-grippable .phui-object-item-frame { - padding-left: 0; -} - -.phui-object-item-list-header { - padding: 0 0 8px 0; - color: {$darkgreytext}; -} - -.phui-object-item-table { - display: table; - table-layout: fixed; - width: 100%; -} - -.phui-object-item-table-row { - display: table-row; -} - -.phui-object-item-col0 { - width: 20px; - display: table-cell; - vertical-align: middle; - padding-left: 4px; -} - -.device-phone .phui-object-item-col0 { - vertical-align: top; - padding-top: 8px; -} - -.phui-object-item-col1 { - display: table-cell; - vertical-align: top; -} - -.phui-object-item-col2 { - width: 160px; - display: table-cell; - vertical-align: top; -} - -.device-phone .phui-object-item-col1, -.device-phone .phui-object-item-col2 { - display: block; - width: auto; -} - -/* - Item Actions -------------------------------------------------------------- - - Action buttons, like "Edit" and "Delete". - -*/ - -.phui-object-item-actions { - position: absolute; - right: 4px; - top: 4px; - bottom: 4px; - vertical-align: middle; - text-align: right; -} - -.phui-object-item-actions .phui-list-item-view { - float: right; - height: 100%; - width: 24px; - display: inline-block; - position: relative; -} - -.phui-object-item-actions .phui-list-item-href { - display: inline-block; - position: relative; - width: 24px; - height: 100%; -} - -.device-desktop .phui-object-item-actions .phui-list-item-href:hover { - background: {$hoverblue}; - border-radius: 3px; -} - -.phui-object-item-actions .phui-list-item-icon { - width: 14px; - height: 14px; - position: absolute; - display: block; - top: 50%; - margin-top: -7px; - left: 3px; -} - -.phui-object-item-actions .phui-list-item-name { - display: none; -} - -.phui-object-item-with-1-actions .phui-object-item-content-box { - margin-right: 28px; - overflow: hidden; -} - -.phui-object-item-with-2-actions .phui-object-item-content-box { - margin-right: 54px; - overflow: hidden; -} - -.phui-object-item-with-3-actions .phui-object-item-content-box { - margin-right: 76px; - overflow: hidden; -} - - -/* - Object Box List ----------------------------------------------------------- - - Tighter, stacking list when inside an Object Box - -*/ - -.phui-object-box .phui-object-item-list-view { - padding: 0; - border: none; -} - -.phui-object-box .phui-object-item-frame { - border-right: none; -} - -.phui-object-box .phui-object-item:last-child - .phui-object-item-frame { - border-bottom: none; -} - - -/* - Subhead ------------------------------------------------------------------- - - Descriptive Text or Links under the main header, before attributes. - -*/ - -.phui-object-item-subhead { - color: {$greytext}; - padding: 0 8px 6px; -} - - -/* - Attribute List ------------------------------------------------------------ - - Object attributes, commonly used to render created date, etc. - -*/ - -.phui-object-item-attributes { - padding: 0 8px 6px; - line-height: 18px; - min-height: 21px; -} - -.phui-object-item-attribute { - display: inline-block; - color: {$greytext}; - vertical-align: top; -} - -.phui-object-item-attribute-spacer { - padding: 0 4px; -} - - -/* - Icons --------------------------------------------------------------------- - - Icons, which show object state. On mobile, they are rendered without labels - to save space. - -*/ - -.phui-object-icon-pane { - margin: 8px 0 4px; -} - -.device-phone .phui-object-icon-pane { - margin: 0 0 4px; -} - -.phui-object-item-icons { - padding: 0 4px 0 0; -} - -.device-phone .phui-object-item-icons { - padding: 0 0 0 8px; -} - -ul.phui-object-item-icons { - margin: 0; -} - -.phui-object-item-icon { - vertical-align: middle; - font-size: {$smallerfontsize}; - color: {$greytext}; - text-align: right; - white-space: nowrap; - overflow: hidden; - min-height: 18px; - line-height: 18px; -} - -.device-phone .phui-object-item-icon { - text-align: left; - font-size: 13px; -} - -/* - * Items with icon 'none' still have on mobile, thus creating a weird vertical - * margin for elements which follow - */ -.device-phone .phui-object-item-icon .none { - display: none; -} - -.phui-object-item-icon-image { - width: 14px; - height: 14px; - font-size: 13px; - margin-right: 4px; -} - -/* - Bar Colors ---------------------------------------------------------------- - Colors for the left-hand border bars, used to indicate object status or other - attributes. -*/ - -.phui-object-item { - border-left-width: 0; -} - -.phui-object-item-bar-color-red { - border-left-color: {$red}; -} - -.phui-object-item-bar-color-orange { - border-left-color: {$orange}; -} - -.phui-object-item-bar-color-yellow { - border-left-color: {$yellow}; -} - -.phui-object-item-bar-color-green { - border-left-color: {$green}; -} - -.phui-object-item-bar-color-sky { - border-left-color: {$sky}; -} - -.phui-object-item-bar-color-blue { - border-left-color: {$blue}; -} - -.phui-object-item-bar-color-indigo { - border-left-color: {$indigo}; -} - -.phui-object-item-bar-color-violet { - border-left-color: {$violet}; -} - -.phui-object-item-bar-color-pink { - border-left-color: {$pink}; -} - -.phui-object-item-bar-color-fire { - border-left-color: {$fire}; -} - -.phui-object-item-bar-color-bluegrey { - border-left-color: {$bluetext}; -} - -.phui-object-item-bar-color-lightbluetext { - border-left-color: {$lightbluetext}; -} - -.phui-object-item-bar-color-grey, -.phui-object-item-bar-color-lightgreytext { - border-left-color: {$lightgreytext}; -} - -.phui-object-item-bar-color-black, -.phui-object-item-bar-color-dark { - border-left-color: {$darkgreytext}; -} - - -/* - Disabled ------------------------------------------------------------------ - - Disabled/inactive objects. - -*/ - - -.phui-object-item.phui-object-item-disabled .phui-object-item-link, -.phui-object-item.phui-object-item-disabled .phui-object-item-link a { - color: {$lightgreytext}; -} - -.phui-object-item.phui-object-item-disabled .phui-object-item-frame { - border-color: #d7d7d7; -} - -.phui-object-item.phui-object-item-disabled .phui-object-item-objname { - color: {$greytext}; - text-decoration: line-through; -} - - -/* - Effects ------------------------------------------------------------------- - - Effects like highlighted items. - -*/ - -.phui-object-item.phui-object-item-highlighted { - background: {$sh-yellowbackground}; -} - -ul.phui-object-item-list-view .phui-object-item-highlighted - .phui-object-item-frame { - border-color: {$sh-yellowborder}; -} - -.phui-object-item-selected { - background: {$sh-bluebackground}; -} - -ul.phui-object-item-list-view .phui-object-item-selected - .phui-object-item-frame { - border-color: {$sh-blueborder}; -} - - -/* - Handle Icons -------------------------------------------------------------- - - Shows owners, reviewers, etc., using profile picture icons. - -*/ - -.phui-object-item-handle-icons { - bottom: 0; - right: 4px; - position: absolute; -} - -.phui-object-item-handle-icon { - width: 24px; - height: 24px; - display: inline-block; - background-size: 100%; - border-radius: 3px; - background-repeat: no-repeat; -} - - -/* - Bylines ------------------------------------------------------------------- - - Shows owners, authors, reviewers, etc., in text. - -*/ - -.phui-object-item-bylines { - padding: 0 4px 0 8px; - margin: 4px 0 8px; - font-size: {$smallerfontsize}; - color: {$greytext}; - text-align: right; -} - -.phui-object-item-byline { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; -} - -.device-phone .phui-object-item-bylines { - float: none; - text-align: left; - padding: 0 8px; - font-size: {$normalfontsize}; -} - - -/* - Draggable List ------------------------------------------------------------ - - These classes are applied by and/or provided for use with JX.DraggableList. - -*/ - -.drag-ghost { - position: relative; - background: {$sh-indigobackground}; - border-radius: 3px; - margin-bottom: 4px; - border: 1px dashed {$sh-indigoborder}; -} - -.drag-dragging { - opacity: 0.25; -} - -.drag-sending { - opacity: 0.5; -} - -.drag-clone, -.drag-frame { - /* This allows mousewheel events to pass through the clone and frame while - they are being dragged. Without this, the mousewheel does not work during - a drag operation. */ - pointer-events: none; -} - -.drag-frame { - position: fixed; - overflow: hidden; - left: 0; - right: 0; - top: 0; - bottom: 0; -} - -.drag-clone { - position: absolute; - list-style: none; -} - -/* - Badges ---------------------------------------------------------------- */ - -.phui-object-item-col0.phui-object-item-badge { - width: 28px; -} - -.phui-object-item-col0.phui-object-item-badge .phui-icon-view { - left: 0; -} - -/* - Countdowns ------------------------------------------------------------ */ - -.phui-object-item-col0.phui-object-item-countdown { - width: 52px; - padding: 0; -} - -.phui-object-item-countdown .phui-object-item-countdown-number { - border-right: 1px solid {$thinblueborder}; - text-align: center; - color: {$bluetext}; -} - - -/* - Dashboards ------------------------------------------------------------ */ - -.phui-object-box .phui-object-item-list-view .phui-object-item-frame { - border: none; - border-bottom: 1px solid {$thinblueborder}; -} - -.drag-clone.phui-object-item-standard .phui-object-item-frame { - border: none; - opacity: 0.8; - background: {$sh-bluebackground}; -} - -.phui-object-box .phui-object-item-list-header { - font-size: {$normalfontsize}; - color: {$darkbluetext}; - border-top: 1px solid {$thinblueborder}; - border-bottom: 1px solid {$thinblueborder}; - padding: 8px; - background-color: {$lightgreybackground}; -} - -.phui-object-box .phui-header-shell + .phui-object-item-list-view - .phui-object-item-list-header, -.phui-object-box .phui-object-box-hidden-content + .phui-object-item-list-view - .phui-object-item-list-header, -.phui-object-box .phui-object-box-hidden-content + - .phui-object-item-list-header { - border-top: none; - } - -.dashboard-pane .phui-object-item-empty .phui-info-view { - border: none; - margin: 0; -} - -.device-desktop .aphront-multi-column-fluid .aphront-multi-column-2-up - .aphront-multi-column-column-outer.third .phui-object-item-col2 { - display: none; - } - - -/* - Launcher List ---------------------------------------------------------- */ - -.phui-object-item-image-icon { - background: none; - width: 40px; - height: 40px; - margin: 8px 6px; - position: absolute; -} - -.phui-object-item-image-icon .phui-icon-view { - position: absolute; - width: 40px; - height: 40px; - font-size: 26px; - text-align: center; - line-height: 36px; -} - -.phui-object-item-image { - width: 40px; - height: 40px; - border-radius: 3px; - background-size: 100%; - margin: 8px 6px; - position: absolute; -} - -.phui-object-item-with-image-icon .phui-object-item-frame, -.phui-object-item-with-image .phui-object-item-frame { - min-height: 52px; -} - -.phui-object-item-with-image-icon .phui-object-item-content-box, -.phui-object-item-with-image .phui-object-item-content-box { - margin-left: 46px; -} - -/* - Launcher Button -------------------------------------------------------- */ - -.phui-object-item-col2.phui-object-item-launch-button { - text-align: right; - vertical-align: middle; - padding-right: 4px; -} - -.device-phone .phui-object-item-col2.phui-object-item-launch-button { - padding: 0 8px 8px; - text-align: left; -} - -/* - Simple List------------------------------------------------------------- */ - -.phui-object-list-simple .phui-object-item-with-image .phui-object-item-frame { - min-height: 26px; -} - -.phui-object-list-simple .phui-object-item-image { - height: 26px; - width: 26px; - margin: 0; -} - -.phui-object-list-simple .phui-object-item-with-image - .phui-object-item-content-box { - margin-left: 32px; -} - -.phui-object-list-simple .phui-object-item-name { - padding: 2px 0; -} - -.phui-object-list-simple .phui-object-item-name a { - color: {$darkbluetext}; -} - -.phui-object-item-list-view.phui-object-list-simple .phui-object-item-frame { - border: none; - margin-bottom: 4px; -} - -.phui-object-item-list-view.phui-object-list-simple li:last-child - .phui-object-item-frame { - margin: 0; -} - -.phui-object-list-simple .phui-object-item-actions { - top: 2px; - bottom: 2px; - right: 2px; -} - -/* - Big List---------------------------------------------------------------- */ - -.phui-object-list-big ul.phui-object-item-list-view { - margin: 0; - padding: 20px; -} - -.phui-object-list-big .phui-object-item-no-bar .phui-object-item-frame { - border: 0; -} - -.phui-object-list-big .phui-object-item-image-icon { - margin: 8px 2px 12px; -} - -.phui-object-list-big a.phui-object-item-link { - color: #000; - font-size: {$biggestfontsize}; -} - -.phui-object-list-big .phui-object-item-name { - padding-top: 6px; -} - -.phui-object-list-big .phui-object-item-launch-button a.button { - font-size: {$normalfontsize}; - padding: 3px 12px 4px; -} - -.device-desktop .phui-object-list-big .phui-object-item { - margin-bottom: 8px; -} - -.phui-object-list-big .phui-object-item-col0 { - vertical-align: top; - padding: 0; -} - -.phui-object-list-big .phui-object-item-status-icon { - padding: 5px; -} - -.phui-object-list-big .phui-object-item-visited a.phui-object-item-link { - color: {$violet}; -} - -.device-desktop .phui-object-list-big .phui-object-item-frame:hover { - -} diff --git a/webroot/rsrc/css/phui/phui-tag-view.css b/webroot/rsrc/css/phui/phui-tag-view.css index 729c4719e5..f14909bc06 100644 --- a/webroot/rsrc/css/phui/phui-tag-view.css +++ b/webroot/rsrc/css/phui/phui-tag-view.css @@ -145,11 +145,11 @@ a.phui-tag-view:hover margin-top: 4px; } -.phui-object-item .phabricator-handle-tag-list { +.phui-oi .phabricator-handle-tag-list { display: inline; } -.phui-object-item .phabricator-handle-tag-list-item { +.phui-oi .phabricator-handle-tag-list-item { display: inline-block; margin: 0 4px 2px 0; } diff --git a/webroot/rsrc/css/phui/phui-two-column-view.css b/webroot/rsrc/css/phui/phui-two-column-view.css index a486231a63..0020df8b84 100644 --- a/webroot/rsrc/css/phui/phui-two-column-view.css +++ b/webroot/rsrc/css/phui/phui-two-column-view.css @@ -199,7 +199,7 @@ padding: 12px; } -.phui-two-column-view .phui-side-column .phui-object-item-empty +.phui-two-column-view .phui-side-column .phui-oi-empty .phui-info-view { margin-bottom: 0; } diff --git a/webroot/rsrc/css/phui/workboards/phui-workcard.css b/webroot/rsrc/css/phui/workboards/phui-workcard.css index 64792c6915..5af162b4bc 100644 --- a/webroot/rsrc/css/phui/workboards/phui-workcard.css +++ b/webroot/rsrc/css/phui/workboards/phui-workcard.css @@ -2,7 +2,7 @@ * @provides phui-workcard-view-css */ -.phui-workcard.phui-object-item { +.phui-workcard.phui-oi { background-color: #fff; border-radius: 3px; margin-bottom: 8px; @@ -10,22 +10,22 @@ box-sizing: border-box; } -.phui-workcard .phui-object-item-name { +.phui-workcard .phui-oi-name { padding-bottom: 4px; } -.phui-workcard .phui-object-item-content { +.phui-workcard .phui-oi-content { margin-top: 0; } -.phui-workcard .phui-object-item-frame { +.phui-workcard .phui-oi-frame { border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-color: {$thinblueborder}; border-bottom-color: {$lightblueborder}; } -.phui-workcard.phui-object-item .phui-object-item-objname { +.phui-workcard.phui-oi .phui-oi-objname { -webkit-touch-callout: text; -webkit-user-select: text; -khtml-user-select: text; @@ -34,36 +34,36 @@ user-select: text; } -.phui-workcard .phui-object-item-link { +.phui-workcard .phui-oi-link { white-space: normal; font-weight: normal; color: #000; margin-left: 2px; } -.phui-object-item-disabled.phui-workcard { +.phui-oi-disabled.phui-workcard { background-color: rgba({$alphawhite},.67); } -.phui-object-item-disabled.phui-workcard .phui-object-item-link { +.phui-oi-disabled.phui-workcard .phui-oi-link { color: {$greytext}; } -.device-desktop .phui-workcard .phui-object-item-with-1-actions - .phui-object-item-content-box { +.device-desktop .phui-workcard .phui-oi-with-1-actions + .phui-oi-content-box { margin-right: 0; overflow: hidden; } -.phui-workcard .phui-object-item-objname { +.phui-workcard .phui-oi-objname { vertical-align: top; } -.phui-workcard.phui-object-item-grippable .phui-object-item-frame { +.phui-workcard.phui-oi-grippable .phui-oi-frame { padding-left: 0; } -.phui-workcard .phui-object-item-grip { +.phui-workcard .phui-oi-grip { display: none; } @@ -71,28 +71,28 @@ display: none; } -.phui-workcard.phui-object-item .phui-list-item-href { +.phui-workcard.phui-oi .phui-list-item-href { height: 24px; width: 24px; } -.device-desktop .phui-workcard.phui-object-item:hover +.device-desktop .phui-workcard.phui-oi:hover .phui-list-item-href { background: #fff; opacity: .7; } -.device-desktop .phui-workcard.phui-object-item +.device-desktop .phui-workcard.phui-oi .phui-list-item-href:hover { background: {$sh-bluebackground}; opacity: 1; } -.phui-workcard.phui-object-item:hover .phui-list-item-icon { +.phui-workcard.phui-oi:hover .phui-list-item-icon { display: block; } -.phui-workcard .phui-object-item-attributes { +.phui-workcard .phui-oi-attributes { margin-right: 12px; } @@ -100,21 +100,21 @@ margin-bottom: 8px; } -.phui-workcard .phui-object-item-cover-image { +.phui-workcard .phui-oi-cover-image { display: block; padding: 8px 8px 0 8px; width: 263px; } -.phui-workcard.phui-object-item.phui-workcard-upload-target { +.phui-workcard.phui-oi.phui-workcard-upload-target { background-color: {$sh-greenbackground}; } -.phui-object-item-list-view .phui-workcard:last-child { +.phui-oi-list-view .phui-workcard:last-child { margin-bottom: 0; } -.phui-workcard .phui-object-item-attribute-spacer { +.phui-workcard .phui-oi-attribute-spacer { display: none; } @@ -123,54 +123,54 @@ display: inline-block; } -.phui-workcard .phui-object-item-attribute { +.phui-workcard .phui-oi-attribute { display: inline; } /* - Draggable Colors --------------------------------------------------------*/ -.phui-workcard.phui-object-item.drag-clone { +.phui-workcard.phui-oi.drag-clone { box-shadow: {$dropshadow}; background-color: {$sh-greybackground}; } -.phui-workcard.phui-object-item.drag-clone .phui-list-item-href { +.phui-workcard.phui-oi.drag-clone .phui-list-item-href { display: none; } -.phui-workcard.drag-clone.phui-object-item-bar-color-red { +.phui-workcard.drag-clone.phui-oi-bar-color-red { background-color: {$sh-redbackground}; } -.phui-workcard.drag-clone.phui-object-item-bar-color-orange { +.phui-workcard.drag-clone.phui-oi-bar-color-orange { background-color: {$sh-orangebackground}; } -.phui-workcard.drag-clone.phui-object-item-bar-color-yellow { +.phui-workcard.drag-clone.phui-oi-bar-color-yellow { background-color: {$sh-yellowbackground}; } -.phui-workcard.drag-clone.phui-object-item-bar-color-green { +.phui-workcard.drag-clone.phui-oi-bar-color-green { background-color: {$sh-greenbackground}; } -.phui-workcard.drag-clone.phui-object-item-bar-color-blue { +.phui-workcard.drag-clone.phui-oi-bar-color-blue { background-color: {$sh-bluebackground}; } -.phui-workcard.drag-clone.phui-object-item-bar-color-indigo { +.phui-workcard.drag-clone.phui-oi-bar-color-indigo { background-color: {$sh-indigobackground}; } -.phui-workcard.drag-clone.phui-object-item-bar-color-violet { +.phui-workcard.drag-clone.phui-oi-bar-color-violet { background-color: {$sh-violetbackground}; } -.phui-workcard.drag-clone.phui-object-item-bar-color-pink { +.phui-workcard.drag-clone.phui-oi-bar-color-pink { background-color: {$sh-pinkbackground}; } -.phui-workcard.drag-clone.phui-object-item-bar-color-sky { +.phui-workcard.drag-clone.phui-oi-bar-color-sky { background-color: {$sh-bluebackground}; } diff --git a/webroot/rsrc/css/phui/workboards/phui-workpanel.css b/webroot/rsrc/css/phui/workboards/phui-workpanel.css index 899c6f74eb..617ff5aa6d 100644 --- a/webroot/rsrc/css/phui/workboards/phui-workpanel.css +++ b/webroot/rsrc/css/phui/workboards/phui-workpanel.css @@ -83,7 +83,7 @@ width: auto; } -.phui-workpanel-body .phui-object-item-list-view { +.phui-workpanel-body .phui-oi-list-view { min-height: 54px; background-color: transparent; } @@ -115,18 +115,18 @@ border-radius: 4px; } -.project-panel-empty .phui-object-item-list-view { +.project-panel-empty .phui-oi-list-view { background: rgba(234, 230, 247, 0.85); border-radius: 3px; margin-bottom: 4px; border: 1px dashed {$sh-indigoborder}; } -.project-panel-empty .phui-object-item-list-view .drag-ghost { +.project-panel-empty .phui-oi-list-view .drag-ghost { display: none; } -.project-panel-empty .phui-object-item-list-view.drag-target-list { +.project-panel-empty .phui-oi-list-view.drag-target-list { background: rgba({$alphawhite},.7); } diff --git a/webroot/rsrc/js/application/maniphest/behavior-batch-selector.js b/webroot/rsrc/js/application/maniphest/behavior-batch-selector.js index 30a557e268..b7728abb57 100644 --- a/webroot/rsrc/js/application/maniphest/behavior-batch-selector.js +++ b/webroot/rsrc/js/application/maniphest/behavior-batch-selector.js @@ -35,7 +35,7 @@ JX.behavior('maniphest-batch-selector', function(config) { JX.DOM.alterClass( task, - 'phui-object-item-selected', + 'phui-oi-selected', is_selected(task)); update(); From 378387a0785f10b6d533b805b1edfe666bf5750e Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 14 Dec 2016 14:00:25 -0800 Subject: [PATCH 35/78] Fix an issue with mentioning revisions on the new EditEngine code Summary: Ref T12020. Ref T11114. If we continue here on a mention, we try to generate `$old`, which requires reviewers to be attached. They won't be for simple codepaths like mentions. Instead, just bail early: we don't need to do anything anyway since we can't possibly find any more errors with zero transactions. Test Plan: Mentioned a revision on a task. Reviewers: chad, avivey Reviewed By: avivey Maniphest Tasks: T11114, T12020 Differential Revision: https://secure.phabricator.com/D17059 --- .../xaction/DifferentialRevisionReviewersTransaction.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php b/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php index 9d22db1735..6c67f48706 100644 --- a/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php +++ b/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php @@ -286,6 +286,13 @@ final class DifferentialRevisionReviewersTransaction $actor = $this->getActor(); $errors = array(); + if (!$xactions) { + // If we aren't applying new reviewer transactions, just bail. We need + // reviewers to be attached to the revision continue validation, and + // they won't always be (for example, when mentioning a revision). + return $errors; + } + $author_phid = $object->getAuthorPHID(); $config_self_accept_key = 'differential.allow-self-accept'; $allow_self_accept = PhabricatorEnv::getEnvConfig($config_self_accept_key); From 3d8d98bd8deb86e1cd6d988415878d365d9e47d4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 14 Dec 2016 14:05:37 -0800 Subject: [PATCH 36/78] Probably (?) fix two very old project slug migrations Summary: Fixes T12020. These callsites to `getPhrictionSlug()` were missed when that method was removed. They're very old (early 2014, late 2011). Test Plan: These are tricky to test because the migrations are so ancient, but `bin/storage upgrade --force --apply phabricator:20140521.projectslug.2.mig.php` gave me //plausible// results. The other migration is so ancient that it can't apply to a modern database so I'm just kind of winging that one. We probably have essentially no installs which will ever apply it again, though. Reviewers: chad, avivey Reviewed By: avivey Maniphest Tasks: T12020 Differential Revision: https://secure.phabricator.com/D17060 --- .../sql/autopatches/20140521.projectslug.2.mig.php | 13 ++++++++----- .../sql/patches/090.forceuniqueprojectnames.php | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/resources/sql/autopatches/20140521.projectslug.2.mig.php b/resources/sql/autopatches/20140521.projectslug.2.mig.php index ca6ccf886a..e0ad4b5070 100644 --- a/resources/sql/autopatches/20140521.projectslug.2.mig.php +++ b/resources/sql/autopatches/20140521.projectslug.2.mig.php @@ -4,27 +4,30 @@ $project_table = new PhabricatorProject(); $table_name = $project_table->getTableName(); $conn_w = $project_table->establishConnection('w'); $slug_table_name = id(new PhabricatorProjectSlug())->getTableName(); -$time = time(); +$time = PhabricatorTime::getNow(); -echo pht('Migrating project phriction slugs...')."\n"; +echo pht('Migrating projects to slugs...')."\n"; foreach (new LiskMigrationIterator($project_table) as $project) { $id = $project->getID(); echo pht('Migrating project %d...', $id)."\n"; - $phriction_slug = rtrim($project->getPhrictionSlug(), '/'); + + $slug_text = PhabricatorSlug::normalizeProjectSlug($project->getName()); $slug = id(new PhabricatorProjectSlug()) - ->loadOneWhere('slug = %s', $phriction_slug); + ->loadOneWhere('slug = %s', $slug_text); + if ($slug) { echo pht('Already migrated %d... Continuing.', $id)."\n"; continue; } + queryfx( $conn_w, 'INSERT INTO %T (projectPHID, slug, dateCreated, dateModified) '. 'VALUES (%s, %s, %d, %d)', $slug_table_name, $project->getPHID(), - $phriction_slug, + $slug_text, $time, $time); echo pht('Migrated %d.', $id)."\n"; diff --git a/resources/sql/patches/090.forceuniqueprojectnames.php b/resources/sql/patches/090.forceuniqueprojectnames.php index a3e029d50a..486856c1c3 100644 --- a/resources/sql/patches/090.forceuniqueprojectnames.php +++ b/resources/sql/patches/090.forceuniqueprojectnames.php @@ -96,7 +96,9 @@ function rename_project($project, $projects) { if ($other->getID() == $project->getID()) { continue; } - if ($other->getPhrictionSlug() == $new_slug) { + + $other_slug = PhabricatorSlug::normalizeProjectSlug($other->getName()); + if ($other_slug == $new_slug) { $okay = false; break; } From 552c5466898870ea98087f3b01c428c634da5cff Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 14 Dec 2016 07:59:14 -0800 Subject: [PATCH 37/78] Separate commit message parsing and validation from Conduit Summary: Ref T11114. I want to move this step away from custom fields. To start with, isolate all the parsing in one class with a clearer API boundary. Next, I'll make this class use new field objects to perform parsing, without CustomField interactions. Test Plan: Created and edited revisions from the CLI, using valid and invalid commit messages. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17055 --- ...tialParseCommitMessageConduitAPIMethod.php | 74 +++------------ .../DifferentialCommitMessageParser.php | 95 ++++++++++++++++++- 2 files changed, 107 insertions(+), 62 deletions(-) diff --git a/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php index dc29ff07a9..1e82dc935b 100644 --- a/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php @@ -3,8 +3,6 @@ final class DifferentialParseCommitMessageConduitAPIMethod extends DifferentialConduitAPIMethod { - private $errors; - public function getAPIMethodName() { return 'differential.parsecommitmessage'; } @@ -25,63 +23,30 @@ final class DifferentialParseCommitMessageConduitAPIMethod } protected function execute(ConduitAPIRequest $request) { - $viewer = $request->getUser(); - $corpus = $request->getValue('corpus'); + $viewer = $this->getViewer(); + + $parser = DifferentialCommitMessageParser::newStandardParser($viewer); + $is_partial = $request->getValue('partial'); - - $field_list = PhabricatorCustomField::getObjectFields( - new DifferentialRevision(), - DifferentialCustomField::ROLE_COMMITMESSAGE); - $field_list->setViewer($viewer); - $field_map = mpull($field_list->getFields(), null, 'getFieldKeyForConduit'); - - $corpus_map = $this->parseCommitMessage($corpus); - - $values = array(); - foreach ($corpus_map as $field_key => $text_value) { - $field = idx($field_map, $field_key); - - if (!$field) { - throw new Exception( - pht( - 'Parser emitted text value for field key "%s", but no such '. - 'field exists.', - $field_key)); - } - - try { - $values[$field_key] = $field->parseValueFromCommitMessage($text_value); - } catch (DifferentialFieldParseException $ex) { - $this->errors[] = pht( - 'Error parsing field "%s": %s', - $field->renderCommitMessageLabel(), - $ex->getMessage()); - } + if ($is_partial) { + $parser->setRaiseMissingFieldErrors(false); } - if (!$is_partial) { - foreach ($field_map as $key => $field) { - try { - $field->validateCommitMessageValue(idx($values, $key)); - } catch (DifferentialFieldValidationException $ex) { - $this->errors[] = pht( - 'Invalid or missing field "%s": %s', - $field->renderCommitMessageLabel(), - $ex->getMessage()); - } - } - } + $corpus = $request->getValue('corpus'); + $field_map = $parser->parseFields($corpus); + + $errors = $parser->getErrors(); // grab some extra information about the Differential Revision: field... $revision_id_field = new DifferentialRevisionIDField(); $revision_id_value = idx( - $corpus_map, + $field_map, $revision_id_field->getFieldKeyForConduit()); $revision_id_valid_domain = PhabricatorEnv::getProductionURI(''); return array( - 'errors' => $this->errors, - 'fields' => $values, + 'errors' => $errors, + 'fields' => $field_map, 'revisionIDFieldInfo' => array( 'value' => $revision_id_value, 'validDomain' => $revision_id_valid_domain, @@ -89,17 +54,4 @@ final class DifferentialParseCommitMessageConduitAPIMethod ); } - private function parseCommitMessage($corpus) { - $viewer = $this->getViewer(); - $parser = DifferentialCommitMessageParser::newStandardParser($viewer); - $result = $parser->parseCorpus($corpus); - - $this->errors = array(); - foreach ($parser->getErrors() as $error) { - $this->errors[] = $error; - } - - return $result; - } - } diff --git a/src/applications/differential/parser/DifferentialCommitMessageParser.php b/src/applications/differential/parser/DifferentialCommitMessageParser.php index ff76b30e51..8cd508ef5f 100644 --- a/src/applications/differential/parser/DifferentialCommitMessageParser.php +++ b/src/applications/differential/parser/DifferentialCommitMessageParser.php @@ -21,11 +21,12 @@ */ final class DifferentialCommitMessageParser extends Phobject { + private $viewer; private $labelMap; private $titleKey; private $summaryKey; private $errors; - + private $raiseMissingFieldErrors = true; public static function newStandardParser(PhabricatorUser $viewer) { @@ -60,6 +61,7 @@ final class DifferentialCommitMessageParser extends Phobject { } return id(new self()) + ->setViewer($viewer) ->setLabelMap($label_map) ->setTitleKey($key_title) ->setSummaryKey($key_summary); @@ -69,6 +71,40 @@ final class DifferentialCommitMessageParser extends Phobject { /* -( Configuring the Parser )--------------------------------------------- */ + /** + * @task config + */ + public function setViewer(PhabricatorUser $viewer) { + $this->viewer = $viewer; + return $this; + } + + + /** + * @task config + */ + public function getViewer() { + return $this->viewer; + } + + + /** + * @task config + */ + public function setRaiseMissingFieldErrors($raise) { + $this->raiseMissingFieldErrors = $raise; + return $this; + } + + + /** + * @task config + */ + public function getRaiseMissingFieldErrors() { + return $this->raiseMissingFieldErrors; + } + + /** * @task config */ @@ -215,6 +251,63 @@ final class DifferentialCommitMessageParser extends Phobject { } + /** + * @task parse + */ + public function parseFields($corpus) { + $viewer = $this->getViewer(); + $text_map = $this->parseCorpus($corpus); + + $field_list = PhabricatorCustomField::getObjectFields( + new DifferentialRevision(), + DifferentialCustomField::ROLE_COMMITMESSAGE); + $field_list->setViewer($viewer); + + $field_map = $field_list->getFields(); + $field_map = mpull($field_map, null, 'getFieldKeyForConduit'); + + $result_map = array(); + foreach ($text_map as $field_key => $text_value) { + $field = idx($field_map, $field_key); + if (!$field) { + // This is a strict error, since we only parse fields which we have + // been told are valid. The caller probably handed us an invalid label + // map. + throw new Exception( + pht( + 'Parser emitted a field with key "%s", but no corresponding '. + 'field definition exists.', + $field_key)); + } + + try { + $result = $field->parseValueFromCommitMessage($text_value); + $result_map[$field_key] = $result; + } catch (DifferentialFieldParseException $ex) { + $this->errors[] = pht( + 'Error parsing field "%s": %s', + $field->renderCommitMessageLabel(), + $ex->getMessage()); + } + } + + if ($this->getRaiseMissingFieldErrors()) { + foreach ($field_map as $key => $field) { + try { + $field->validateCommitMessageValue(idx($result_map, $key)); + } catch (DifferentialFieldValidationException $ex) { + $this->errors[] = pht( + 'Invalid or missing field "%s": %s', + $field->renderCommitMessageLabel(), + $ex->getMessage()); + } + } + } + + return $result_map; + } + + /** * @task parse */ From 8476ad1a281cd8d8c9707956090d7a5642a6dc46 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 14 Dec 2016 08:14:52 -0800 Subject: [PATCH 38/78] Separate all commit message field parsing out of Differential custom fields Summary: Ref T11114. See that task for some discussion. Overall, Differential custom fields ended up with too many responsibilities. Later work in EditEngine provides a more promising model for achieving modularity with smaller, more consistent components. In particular, we have some custom fields like `DifferentialGitSVNIDField` and `DifferentialConflictsField` which serve //only// to support the field parser. This starts pulling commit message responsibilities out of the core list of custom fields and into simpler dedicated parsers. Test Plan: Created and edited revisions from the CLI. Added a bit of test coverage. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17058 --- src/__phutil_library_map__.php | 32 ++++++ ...DifferentialAuditorsCommitMessageField.php | 21 ++++ ...rentialBlameRevisionCommitMessageField.php | 22 ++++ .../field/DifferentialCommitMessageField.php | 92 ++++++++++++++++ ...ifferentialConflictsCommitMessageField.php | 12 +++ ...DifferentialGitSVNIDCommitMessageField.php | 12 +++ ...fferentialJIRAIssuesCommitMessageField.php | 27 +++++ ...fferentialRevertPlanCommitMessageField.php | 16 +++ ...fferentialReviewedByCommitMessageField.php | 22 ++++ ...ifferentialReviewersCommitMessageField.php | 64 +++++++++++ ...fferentialRevisionIDCommitMessageField.php | 52 +++++++++ ...ferentialSubscribersCommitMessageField.php | 30 ++++++ .../DifferentialSummaryCommitMessageField.php | 12 +++ .../DifferentialTagsCommitMessageField.php | 28 +++++ .../DifferentialTasksCommitMessageField.php | 28 +++++ ...DifferentialTestPlanCommitMessageField.php | 36 +++++++ .../DifferentialTitleCommitMessageField.php | 36 +++++++ .../DifferentialCommitMessageParser.php | 100 +++++++++++------- ...ifferentialCommitMessageParserTestCase.php | 30 ++++++ 19 files changed, 632 insertions(+), 40 deletions(-) create mode 100644 src/applications/differential/field/DifferentialAuditorsCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialBlameRevisionCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialConflictsCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialGitSVNIDCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialJIRAIssuesCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialRevertPlanCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialReviewedByCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialReviewersCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialSubscribersCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialSummaryCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialTagsCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialTasksCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialTestPlanCommitMessageField.php create mode 100644 src/applications/differential/field/DifferentialTitleCommitMessageField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ae8760090d..a70eb1d5ae 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -353,8 +353,10 @@ phutil_register_library_map(array( 'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php', 'DifferentialApplyPatchField' => 'applications/differential/customfield/DifferentialApplyPatchField.php', 'DifferentialAsanaRepresentationField' => 'applications/differential/customfield/DifferentialAsanaRepresentationField.php', + 'DifferentialAuditorsCommitMessageField' => 'applications/differential/field/DifferentialAuditorsCommitMessageField.php', 'DifferentialAuditorsField' => 'applications/differential/customfield/DifferentialAuditorsField.php', 'DifferentialAuthorField' => 'applications/differential/customfield/DifferentialAuthorField.php', + 'DifferentialBlameRevisionCommitMessageField' => 'applications/differential/field/DifferentialBlameRevisionCommitMessageField.php', 'DifferentialBlameRevisionField' => 'applications/differential/customfield/DifferentialBlameRevisionField.php', 'DifferentialBlockHeraldAction' => 'applications/differential/herald/DifferentialBlockHeraldAction.php', 'DifferentialBlockingReviewerDatasource' => 'applications/differential/typeahead/DifferentialBlockingReviewerDatasource.php', @@ -383,10 +385,12 @@ phutil_register_library_map(array( 'DifferentialCloseConduitAPIMethod' => 'applications/differential/conduit/DifferentialCloseConduitAPIMethod.php', 'DifferentialCommentPreviewController' => 'applications/differential/controller/DifferentialCommentPreviewController.php', 'DifferentialCommentSaveController' => 'applications/differential/controller/DifferentialCommentSaveController.php', + 'DifferentialCommitMessageField' => 'applications/differential/field/DifferentialCommitMessageField.php', 'DifferentialCommitMessageParser' => 'applications/differential/parser/DifferentialCommitMessageParser.php', 'DifferentialCommitMessageParserTestCase' => 'applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php', 'DifferentialCommitsField' => 'applications/differential/customfield/DifferentialCommitsField.php', 'DifferentialConduitAPIMethod' => 'applications/differential/conduit/DifferentialConduitAPIMethod.php', + 'DifferentialConflictsCommitMessageField' => 'applications/differential/field/DifferentialConflictsCommitMessageField.php', 'DifferentialConflictsField' => 'applications/differential/customfield/DifferentialConflictsField.php', 'DifferentialController' => 'applications/differential/controller/DifferentialController.php', 'DifferentialCoreCustomField' => 'applications/differential/customfield/DifferentialCoreCustomField.php', @@ -444,6 +448,7 @@ phutil_register_library_map(array( 'DifferentialGetRevisionConduitAPIMethod' => 'applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php', 'DifferentialGetWorkingCopy' => 'applications/differential/DifferentialGetWorkingCopy.php', 'DifferentialGitHubLandingStrategy' => 'applications/differential/landing/DifferentialGitHubLandingStrategy.php', + 'DifferentialGitSVNIDCommitMessageField' => 'applications/differential/field/DifferentialGitSVNIDCommitMessageField.php', 'DifferentialGitSVNIDField' => 'applications/differential/customfield/DifferentialGitSVNIDField.php', 'DifferentialHarbormasterField' => 'applications/differential/customfield/DifferentialHarbormasterField.php', 'DifferentialHiddenComment' => 'applications/differential/storage/DifferentialHiddenComment.php', @@ -461,6 +466,7 @@ phutil_register_library_map(array( 'DifferentialInlineCommentMailView' => 'applications/differential/mail/DifferentialInlineCommentMailView.php', 'DifferentialInlineCommentPreviewController' => 'applications/differential/controller/DifferentialInlineCommentPreviewController.php', 'DifferentialInlineCommentQuery' => 'applications/differential/query/DifferentialInlineCommentQuery.php', + 'DifferentialJIRAIssuesCommitMessageField' => 'applications/differential/field/DifferentialJIRAIssuesCommitMessageField.php', 'DifferentialJIRAIssuesField' => 'applications/differential/customfield/DifferentialJIRAIssuesField.php', 'DifferentialLandingActionMenuEventListener' => 'applications/differential/landing/DifferentialLandingActionMenuEventListener.php', 'DifferentialLandingStrategy' => 'applications/differential/landing/DifferentialLandingStrategy.php', @@ -493,7 +499,9 @@ phutil_register_library_map(array( 'DifferentialResponsibleDatasource' => 'applications/differential/typeahead/DifferentialResponsibleDatasource.php', 'DifferentialResponsibleUserDatasource' => 'applications/differential/typeahead/DifferentialResponsibleUserDatasource.php', 'DifferentialResponsibleViewerFunctionDatasource' => 'applications/differential/typeahead/DifferentialResponsibleViewerFunctionDatasource.php', + 'DifferentialRevertPlanCommitMessageField' => 'applications/differential/field/DifferentialRevertPlanCommitMessageField.php', 'DifferentialRevertPlanField' => 'applications/differential/customfield/DifferentialRevertPlanField.php', + 'DifferentialReviewedByCommitMessageField' => 'applications/differential/field/DifferentialReviewedByCommitMessageField.php', 'DifferentialReviewedByField' => 'applications/differential/customfield/DifferentialReviewedByField.php', 'DifferentialReviewerDatasource' => 'applications/differential/typeahead/DifferentialReviewerDatasource.php', 'DifferentialReviewerForRevisionEdgeType' => 'applications/differential/edge/DifferentialReviewerForRevisionEdgeType.php', @@ -503,6 +511,7 @@ phutil_register_library_map(array( 'DifferentialReviewersAddBlockingSelfHeraldAction' => 'applications/differential/herald/DifferentialReviewersAddBlockingSelfHeraldAction.php', 'DifferentialReviewersAddReviewersHeraldAction' => 'applications/differential/herald/DifferentialReviewersAddReviewersHeraldAction.php', 'DifferentialReviewersAddSelfHeraldAction' => 'applications/differential/herald/DifferentialReviewersAddSelfHeraldAction.php', + 'DifferentialReviewersCommitMessageField' => 'applications/differential/field/DifferentialReviewersCommitMessageField.php', 'DifferentialReviewersField' => 'applications/differential/customfield/DifferentialReviewersField.php', 'DifferentialReviewersHeraldAction' => 'applications/differential/herald/DifferentialReviewersHeraldAction.php', 'DifferentialReviewersView' => 'applications/differential/view/DifferentialReviewersView.php', @@ -530,6 +539,7 @@ phutil_register_library_map(array( 'DifferentialRevisionHasTaskRelationship' => 'applications/differential/relationships/DifferentialRevisionHasTaskRelationship.php', 'DifferentialRevisionHeraldField' => 'applications/differential/herald/DifferentialRevisionHeraldField.php', 'DifferentialRevisionHeraldFieldGroup' => 'applications/differential/herald/DifferentialRevisionHeraldFieldGroup.php', + 'DifferentialRevisionIDCommitMessageField' => 'applications/differential/field/DifferentialRevisionIDCommitMessageField.php', 'DifferentialRevisionIDField' => 'applications/differential/customfield/DifferentialRevisionIDField.php', 'DifferentialRevisionLandController' => 'applications/differential/controller/DifferentialRevisionLandController.php', 'DifferentialRevisionListController' => 'applications/differential/controller/DifferentialRevisionListController.php', @@ -563,9 +573,15 @@ phutil_register_library_map(array( 'DifferentialSchemaSpec' => 'applications/differential/storage/DifferentialSchemaSpec.php', 'DifferentialSetDiffPropertyConduitAPIMethod' => 'applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php', 'DifferentialStoredCustomField' => 'applications/differential/customfield/DifferentialStoredCustomField.php', + 'DifferentialSubscribersCommitMessageField' => 'applications/differential/field/DifferentialSubscribersCommitMessageField.php', 'DifferentialSubscribersField' => 'applications/differential/customfield/DifferentialSubscribersField.php', + 'DifferentialSummaryCommitMessageField' => 'applications/differential/field/DifferentialSummaryCommitMessageField.php', 'DifferentialSummaryField' => 'applications/differential/customfield/DifferentialSummaryField.php', + 'DifferentialTagsCommitMessageField' => 'applications/differential/field/DifferentialTagsCommitMessageField.php', + 'DifferentialTasksCommitMessageField' => 'applications/differential/field/DifferentialTasksCommitMessageField.php', + 'DifferentialTestPlanCommitMessageField' => 'applications/differential/field/DifferentialTestPlanCommitMessageField.php', 'DifferentialTestPlanField' => 'applications/differential/customfield/DifferentialTestPlanField.php', + 'DifferentialTitleCommitMessageField' => 'applications/differential/field/DifferentialTitleCommitMessageField.php', 'DifferentialTitleField' => 'applications/differential/customfield/DifferentialTitleField.php', 'DifferentialTransaction' => 'applications/differential/storage/DifferentialTransaction.php', 'DifferentialTransactionComment' => 'applications/differential/storage/DifferentialTransactionComment.php', @@ -4976,8 +4992,10 @@ phutil_register_library_map(array( 'DifferentialAffectedPath' => 'DifferentialDAO', 'DifferentialApplyPatchField' => 'DifferentialCustomField', 'DifferentialAsanaRepresentationField' => 'DifferentialCustomField', + 'DifferentialAuditorsCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialAuditorsField' => 'DifferentialStoredCustomField', 'DifferentialAuthorField' => 'DifferentialCustomField', + 'DifferentialBlameRevisionCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialBlameRevisionField' => 'DifferentialStoredCustomField', 'DifferentialBlockHeraldAction' => 'HeraldAction', 'DifferentialBlockingReviewerDatasource' => 'PhabricatorTypeaheadCompositeDatasource', @@ -5009,10 +5027,12 @@ phutil_register_library_map(array( 'DifferentialCloseConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialCommentPreviewController' => 'DifferentialController', 'DifferentialCommentSaveController' => 'DifferentialController', + 'DifferentialCommitMessageField' => 'Phobject', 'DifferentialCommitMessageParser' => 'Phobject', 'DifferentialCommitMessageParserTestCase' => 'PhabricatorTestCase', 'DifferentialCommitsField' => 'DifferentialCustomField', 'DifferentialConduitAPIMethod' => 'ConduitAPIMethod', + 'DifferentialConflictsCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialConflictsField' => 'DifferentialCustomField', 'DifferentialController' => 'PhabricatorController', 'DifferentialCoreCustomField' => 'DifferentialCustomField', @@ -5077,6 +5097,7 @@ phutil_register_library_map(array( 'DifferentialGetRevisionConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialGetWorkingCopy' => 'Phobject', 'DifferentialGitHubLandingStrategy' => 'DifferentialLandingStrategy', + 'DifferentialGitSVNIDCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialGitSVNIDField' => 'DifferentialCustomField', 'DifferentialHarbormasterField' => 'DifferentialCustomField', 'DifferentialHiddenComment' => 'DifferentialDAO', @@ -5100,6 +5121,7 @@ phutil_register_library_map(array( 'DifferentialInlineCommentMailView' => 'DifferentialMailView', 'DifferentialInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController', 'DifferentialInlineCommentQuery' => 'PhabricatorOffsetPagedQuery', + 'DifferentialJIRAIssuesCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField', 'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener', 'DifferentialLandingStrategy' => 'Phobject', @@ -5132,7 +5154,9 @@ phutil_register_library_map(array( 'DifferentialResponsibleDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DifferentialResponsibleUserDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DifferentialResponsibleViewerFunctionDatasource' => 'PhabricatorTypeaheadDatasource', + 'DifferentialRevertPlanCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialRevertPlanField' => 'DifferentialStoredCustomField', + 'DifferentialReviewedByCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialReviewedByField' => 'DifferentialCoreCustomField', 'DifferentialReviewerDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DifferentialReviewerForRevisionEdgeType' => 'PhabricatorEdgeType', @@ -5142,6 +5166,7 @@ phutil_register_library_map(array( 'DifferentialReviewersAddBlockingSelfHeraldAction' => 'DifferentialReviewersHeraldAction', 'DifferentialReviewersAddReviewersHeraldAction' => 'DifferentialReviewersHeraldAction', 'DifferentialReviewersAddSelfHeraldAction' => 'DifferentialReviewersHeraldAction', + 'DifferentialReviewersCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialReviewersField' => 'DifferentialCoreCustomField', 'DifferentialReviewersHeraldAction' => 'HeraldAction', 'DifferentialReviewersView' => 'AphrontView', @@ -5185,6 +5210,7 @@ phutil_register_library_map(array( 'DifferentialRevisionHasTaskRelationship' => 'DifferentialRevisionRelationship', 'DifferentialRevisionHeraldField' => 'HeraldField', 'DifferentialRevisionHeraldFieldGroup' => 'HeraldFieldGroup', + 'DifferentialRevisionIDCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialRevisionIDField' => 'DifferentialCustomField', 'DifferentialRevisionLandController' => 'DifferentialController', 'DifferentialRevisionListController' => 'DifferentialController', @@ -5218,9 +5244,15 @@ phutil_register_library_map(array( 'DifferentialSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'DifferentialSetDiffPropertyConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialStoredCustomField' => 'DifferentialCustomField', + 'DifferentialSubscribersCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialSubscribersField' => 'DifferentialCoreCustomField', + 'DifferentialSummaryCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialSummaryField' => 'DifferentialCoreCustomField', + 'DifferentialTagsCommitMessageField' => 'DifferentialCommitMessageField', + 'DifferentialTasksCommitMessageField' => 'DifferentialCommitMessageField', + 'DifferentialTestPlanCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialTestPlanField' => 'DifferentialCoreCustomField', + 'DifferentialTitleCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialTitleField' => 'DifferentialCoreCustomField', 'DifferentialTransaction' => 'PhabricatorModularTransaction', 'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment', diff --git a/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php b/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php new file mode 100644 index 0000000000..fc3bc95fd3 --- /dev/null +++ b/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php @@ -0,0 +1,21 @@ +parseObjectList( + $value, + array( + PhabricatorPeopleUserPHIDType::TYPECONST, + PhabricatorProjectProjectPHIDType::TYPECONST, + )); + } + +} diff --git a/src/applications/differential/field/DifferentialBlameRevisionCommitMessageField.php b/src/applications/differential/field/DifferentialBlameRevisionCommitMessageField.php new file mode 100644 index 0000000000..d48088c68f --- /dev/null +++ b/src/applications/differential/field/DifferentialBlameRevisionCommitMessageField.php @@ -0,0 +1,22 @@ +isCustomFieldEnabled('phabricator:blame-revision'); + } + +} diff --git a/src/applications/differential/field/DifferentialCommitMessageField.php b/src/applications/differential/field/DifferentialCommitMessageField.php new file mode 100644 index 0000000000..ddf5cc5b28 --- /dev/null +++ b/src/applications/differential/field/DifferentialCommitMessageField.php @@ -0,0 +1,92 @@ +viewer = $viewer; + return $this; + } + + final public function getViewer() { + return $this->viewer; + } + + abstract public function getFieldName(); + + public function isFieldEnabled() { + return true; + } + + public function getFieldAliases() { + return array(); + } + + public function validateFieldValue($value) { + return; + } + + public function parseFieldValue($value) { + return $value; + } + + final public function getCommitMessageFieldKey() { + return $this->getPhobjectClassConstant('FIELDKEY', 64); + } + + final public static function newEnabledFields(PhabricatorUser $viewer) { + $fields = self::getAllFields(); + + $results = array(); + foreach ($fields as $key => $field) { + $field = clone $field; + $field->setViewer($viewer); + if ($field->isFieldEnabled()) { + $results[$key] = $field; + } + } + + return $results; + } + + final public static function getAllFields() { + return id(new PhutilClassMapQuery()) + ->setAncestorClass(__CLASS__) + ->setUniqueMethod('getCommitMessageFieldKey') + ->execute(); + } + + protected function raiseParseException($message) { + throw new DifferentialFieldParseException($message); + } + + protected function raiseValidationException($message) { + throw new DifferentialFieldValidationException($message); + } + + protected function parseObjectList( + $value, + array $types, + $allow_partial = false, + array $suffixes = array()) { + return id(new PhabricatorObjectListQuery()) + ->setViewer($this->getViewer()) + ->setAllowedTypes($types) + ->setObjectList($value) + ->setAllowPartialResults($allow_partial) + ->setSuffixes($suffixes) + ->execute(); + } + + protected function isCustomFieldEnabled($key) { + $field_list = PhabricatorCustomField::getObjectFields( + new DifferentialRevision(), + PhabricatorCustomField::ROLE_VIEW); + + $fields = $field_list->getFields(); + return isset($fields[$key]); + } + +} diff --git a/src/applications/differential/field/DifferentialConflictsCommitMessageField.php b/src/applications/differential/field/DifferentialConflictsCommitMessageField.php new file mode 100644 index 0000000000..334a7a060f --- /dev/null +++ b/src/applications/differential/field/DifferentialConflictsCommitMessageField.php @@ -0,0 +1,12 @@ +isCustomFieldEnabled('phabricator:revert-plan'); + } + +} diff --git a/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php b/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php new file mode 100644 index 0000000000..ea222b28aa --- /dev/null +++ b/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php @@ -0,0 +1,22 @@ +parseObjectList( + $value, + array( + PhabricatorPeopleUserPHIDType::TYPECONST, + PhabricatorProjectProjectPHIDType::TYPECONST, + ), + $allow_partial = true); + } + +} diff --git a/src/applications/differential/field/DifferentialReviewersCommitMessageField.php b/src/applications/differential/field/DifferentialReviewersCommitMessageField.php new file mode 100644 index 0000000000..e3c275b471 --- /dev/null +++ b/src/applications/differential/field/DifferentialReviewersCommitMessageField.php @@ -0,0 +1,64 @@ +parseObjectList( + $value, + array( + PhabricatorPeopleUserPHIDType::TYPECONST, + PhabricatorProjectProjectPHIDType::TYPECONST, + PhabricatorOwnersPackagePHIDType::TYPECONST, + ), + false, + array('!')); + + return $this->flattenReviewers($results); + } + + private function flattenReviewers(array $values) { + // NOTE: For now, `arc` relies on this field returning only scalars, so we + // need to reduce the results into scalars. See T10981. + $result = array(); + + foreach ($values as $value) { + $result[] = $value['phid'].implode('', array_keys($value['suffixes'])); + } + + return $result; + } + + private function inflateReviewers(array $values) { + $result = array(); + + foreach ($values as $value) { + if (substr($value, -1) == '!') { + $value = substr($value, 0, -1); + $suffixes = array('!' => '!'); + } else { + $suffixes = array(); + } + + $result[] = array( + 'phid' => $value, + 'suffixes' => $suffixes, + ); + } + + return $result; + } + +} diff --git a/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php b/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php new file mode 100644 index 0000000000..5e2b378e12 --- /dev/null +++ b/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php @@ -0,0 +1,52 @@ +getPath(); + + $matches = null; + if (preg_match('#^/D(\d+)$#', $path, $matches)) { + $id = (int)$matches[1]; + + $prod_uri = new PhutilURI(PhabricatorEnv::getProductionURI('/D'.$id)); + + // Make sure the URI is the same as our URI. Basically, we want to ignore + // commits from other Phabricator installs. + if ($uri->getDomain() == $prod_uri->getDomain()) { + return $id; + } + + $allowed_uris = PhabricatorEnv::getAllowedURIs('/D'.$id); + + foreach ($allowed_uris as $allowed_uri) { + if ($uri_string == $allowed_uri) { + return $id; + } + } + } + + return null; + } + +} diff --git a/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php b/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php new file mode 100644 index 0000000000..ba693a3493 --- /dev/null +++ b/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php @@ -0,0 +1,30 @@ +parseObjectList( + $value, + array( + PhabricatorPeopleUserPHIDType::TYPECONST, + PhabricatorProjectProjectPHIDType::TYPECONST, + PhabricatorOwnersPackagePHIDType::TYPECONST, + )); + } + +} diff --git a/src/applications/differential/field/DifferentialSummaryCommitMessageField.php b/src/applications/differential/field/DifferentialSummaryCommitMessageField.php new file mode 100644 index 0000000000..531d542633 --- /dev/null +++ b/src/applications/differential/field/DifferentialSummaryCommitMessageField.php @@ -0,0 +1,12 @@ +parseObjectList( + $value, + array( + PhabricatorProjectProjectPHIDType::TYPECONST, + )); + } + +} diff --git a/src/applications/differential/field/DifferentialTasksCommitMessageField.php b/src/applications/differential/field/DifferentialTasksCommitMessageField.php new file mode 100644 index 0000000000..652de0ffe6 --- /dev/null +++ b/src/applications/differential/field/DifferentialTasksCommitMessageField.php @@ -0,0 +1,28 @@ +parseObjectList( + $value, + array( + ManiphestTaskPHIDType::TYPECONST, + )); + } + +} diff --git a/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php b/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php new file mode 100644 index 0000000000..d9f1a3e3b6 --- /dev/null +++ b/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php @@ -0,0 +1,36 @@ +isCustomFieldEnabled('differential:test-plan'); + } + + public function validateFieldValue($value) { + $is_required = PhabricatorEnv::getEnvConfig( + 'differential.require-test-plan-field'); + + if ($is_required && !strlen($value)) { + $this->raiseValidationException( + pht( + 'You must provide a test plan. Describe the actions you performed '. + 'to verify the behavior of this change.')); + } + } + +} diff --git a/src/applications/differential/field/DifferentialTitleCommitMessageField.php b/src/applications/differential/field/DifferentialTitleCommitMessageField.php new file mode 100644 index 0000000000..af5ed58545 --- /dev/null +++ b/src/applications/differential/field/DifferentialTitleCommitMessageField.php @@ -0,0 +1,36 @@ +'); + } + + public function parseFieldValue($value) { + if ($value === self::getDefaultTitle()) { + $this->raiseParseException( + pht( + 'Replace the default title line with a human-readable revision '. + 'title which describes the changes you are making.')); + } + + return parent::parseFieldValue($value); + } + + public function validateFieldValue($value) { + if (!strlen($value)) { + $this->raiseValidationException( + pht( + 'You must provide a revision title in the first line '. + 'of your commit message.')); + } + } + +} diff --git a/src/applications/differential/parser/DifferentialCommitMessageParser.php b/src/applications/differential/parser/DifferentialCommitMessageParser.php index 8cd508ef5f..6cf126bd0f 100644 --- a/src/applications/differential/parser/DifferentialCommitMessageParser.php +++ b/src/applications/differential/parser/DifferentialCommitMessageParser.php @@ -26,43 +26,18 @@ final class DifferentialCommitMessageParser extends Phobject { private $titleKey; private $summaryKey; private $errors; + private $commitMessageFields; private $raiseMissingFieldErrors = true; public static function newStandardParser(PhabricatorUser $viewer) { + $key_title = DifferentialTitleCommitMessageField::FIELDKEY; + $key_summary = DifferentialSummaryCommitMessageField::FIELDKEY; - $key_title = id(new DifferentialTitleField())->getFieldKeyForConduit(); - $key_summary = id(new DifferentialSummaryField())->getFieldKeyForConduit(); - - $field_list = PhabricatorCustomField::getObjectFields( - new DifferentialRevision(), - DifferentialCustomField::ROLE_COMMITMESSAGE); - $field_list->setViewer($viewer); - - $label_map = array(); - - foreach ($field_list->getFields() as $field) { - $labels = $field->getCommitMessageLabels(); - $key = $field->getFieldKeyForConduit(); - - foreach ($labels as $label) { - $normal_label = self::normalizeFieldLabel( - $label); - if (!empty($label_map[$normal_label])) { - throw new Exception( - pht( - 'Field label "%s" is parsed by two custom fields: "%s" and '. - '"%s". Each label must be parsed by only one field.', - $label, - $key, - $label_map[$normal_label])); - } - $label_map[$normal_label] = $key; - } - } + $field_list = DifferentialCommitMessageField::newEnabledFields($viewer); return id(new self()) ->setViewer($viewer) - ->setLabelMap($label_map) + ->setCommitMessageFields($field_list) ->setTitleKey($key_title) ->setSummaryKey($key_summary); } @@ -88,6 +63,25 @@ final class DifferentialCommitMessageParser extends Phobject { } + /** + * @task config + */ + public function setCommitMessageFields($fields) { + assert_instances_of($fields, 'DifferentialCommitMessageField'); + $fields = mpull($fields, null, 'getCommitMessageFieldKey'); + $this->commitMessageFields = $fields; + return $this; + } + + + /** + * @task config + */ + public function getCommitMessageFields() { + return $this->commitMessageFields; + } + + /** * @task config */ @@ -141,7 +135,7 @@ final class DifferentialCommitMessageParser extends Phobject { public function parseCorpus($corpus) { $this->errors = array(); - $label_map = $this->labelMap; + $label_map = $this->getLabelMap(); $key_title = $this->titleKey; $key_summary = $this->summaryKey; @@ -258,13 +252,7 @@ final class DifferentialCommitMessageParser extends Phobject { $viewer = $this->getViewer(); $text_map = $this->parseCorpus($corpus); - $field_list = PhabricatorCustomField::getObjectFields( - new DifferentialRevision(), - DifferentialCustomField::ROLE_COMMITMESSAGE); - $field_list->setViewer($viewer); - - $field_map = $field_list->getFields(); - $field_map = mpull($field_map, null, 'getFieldKeyForConduit'); + $field_map = $this->getCommitMessageFields(); $result_map = array(); foreach ($text_map as $field_key => $text_value) { @@ -281,7 +269,7 @@ final class DifferentialCommitMessageParser extends Phobject { } try { - $result = $field->parseValueFromCommitMessage($text_value); + $result = $field->parseFieldValue($text_value); $result_map[$field_key] = $result; } catch (DifferentialFieldParseException $ex) { $this->errors[] = pht( @@ -294,7 +282,7 @@ final class DifferentialCommitMessageParser extends Phobject { if ($this->getRaiseMissingFieldErrors()) { foreach ($field_map as $key => $field) { try { - $field->validateCommitMessageValue(idx($result_map, $key)); + $field->validateFieldValue(idx($result_map, $key)); } catch (DifferentialFieldValidationException $ex) { $this->errors[] = pht( 'Invalid or missing field "%s": %s', @@ -330,6 +318,38 @@ final class DifferentialCommitMessageParser extends Phobject { /* -( Internals )---------------------------------------------------------- */ + private function getLabelMap() { + if ($this->labelMap === null) { + $field_list = $this->getCommitMessageFields(); + + $label_map = array(); + foreach ($field_list as $field_key => $field) { + $labels = $field->getFieldAliases(); + $labels[] = $field->getFieldName(); + + foreach ($labels as $label) { + $normal_label = self::normalizeFieldLabel($label); + if (!empty($label_map[$normal_label])) { + throw new Exception( + pht( + 'Field label "%s" is parsed by two custom fields: "%s" and '. + '"%s". Each label must be parsed by only one field.', + $label, + $field_key, + $label_map[$normal_label])); + } + + $label_map[$normal_label] = $field_key; + } + } + + $this->labelMap = $label_map; + } + + return $this->labelMap; + } + + /** * @task internal */ diff --git a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php index 669cfed220..320445fd0d 100644 --- a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php +++ b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php @@ -41,6 +41,36 @@ final class DifferentialCommitMessageParserTestCase } } + + public function testDifferentialCommitMessageFieldParser() { + $message = << + 'This is the title.', + DifferentialSummaryCommitMessageField::FIELDKEY => + 'This is the summary.', + ); + + $parser = id(new DifferentialCommitMessageParser()) + ->setCommitMessageFields($fields) + ->setTitleKey(DifferentialTitleCommitMessageField::FIELDKEY) + ->setSummaryKey(DifferentialSummaryCommitMessageField::FIELDKEY); + + $actual = $parser->parseFields($message); + + $this->assertEqual($expect, $actual); + } + public function testDifferentialCommitMessageParserNormalization() { $map = array( 'Test Plan' => 'test plan', From 89d88dafcc416670c2acd49cd6232ca607938e62 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 15 Dec 2016 11:23:15 -0800 Subject: [PATCH 39/78] Fix a Differential exception in invalid/missing fields Summary: Ref T11114. Missed this while converting. Test Plan: Tried to create a revision with no test plan. Before: fatal; after: helpful message. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17061 --- .../differential/parser/DifferentialCommitMessageParser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/differential/parser/DifferentialCommitMessageParser.php b/src/applications/differential/parser/DifferentialCommitMessageParser.php index 6cf126bd0f..4b2ba80e92 100644 --- a/src/applications/differential/parser/DifferentialCommitMessageParser.php +++ b/src/applications/differential/parser/DifferentialCommitMessageParser.php @@ -274,7 +274,7 @@ final class DifferentialCommitMessageParser extends Phobject { } catch (DifferentialFieldParseException $ex) { $this->errors[] = pht( 'Error parsing field "%s": %s', - $field->renderCommitMessageLabel(), + $field->getFieldName(), $ex->getMessage()); } } @@ -286,7 +286,7 @@ final class DifferentialCommitMessageParser extends Phobject { } catch (DifferentialFieldValidationException $ex) { $this->errors[] = pht( 'Invalid or missing field "%s": %s', - $field->renderCommitMessageLabel(), + $field->getFieldName(), $ex->getMessage()); } } From de4d7e1b1064b180a04b3bb488499469943ef700 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 15 Dec 2016 11:27:49 -0800 Subject: [PATCH 40/78] Support arbitrarily long filenames in Differential Summary: Fixes T11660. Currently, if you try to diff a path with more than 255 total characters, we fail to create the diff because we have a `text255` column. There are actually two issues here: - File names may be arbitrarily long (T11660). - File names may not be UTF8 (T6633, etc). This is much more complicated and has other issues -- largely that we can't JSON-encode non-UTF8 filenames. I'm punting on that for now and will deal with it later. This doesn't specifically address non-UTF8 paths, although it is a change that's (probably?) required to eventually support them. This will cause some potentially slow migrations, but better to do them now, if possible, so we have fewer complicated/slow upgrades overall. Test Plan: Created a change touching file: //very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_directory_name/very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_filename.txt// {F2137737} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11660 Differential Revision: https://secure.phabricator.com/D17062 --- .../differential/storage/DifferentialChangeset.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php index 57f9d295b6..448cdb6343 100644 --- a/src/applications/differential/storage/DifferentialChangeset.php +++ b/src/applications/differential/storage/DifferentialChangeset.php @@ -30,8 +30,8 @@ final class DifferentialChangeset extends DifferentialDAO 'awayPaths' => self::SERIALIZATION_JSON, ), self::CONFIG_COLUMN_SCHEMA => array( - 'oldFile' => 'text255?', - 'filename' => 'text255', + 'oldFile' => 'bytes?', + 'filename' => 'bytes', 'changeType' => 'uint32', 'fileType' => 'uint32', 'addLines' => 'uint32', From f277de1d0222cecc939de31a1a22013e43e23f80 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 15 Dec 2016 14:22:42 -0800 Subject: [PATCH 41/78] Add a basic ProjectProfileMenuItem Summary: Allows you to name and set a project as a menu item navigation element. Test Plan: Add a project, no name, see project. Remove. Add a project and give it a short name (bugs) and see project link. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17021 --- src/__phutil_library_map__.php | 2 + .../engine/PhabricatorProfileMenuEngine.php | 14 ++- .../menuitem/PhabricatorProfileMenuItem.php | 2 + .../PhabricatorProjectProfileMenuItem.php | 113 ++++++++++++++++++ ...catorProfileMenuItemConfigurationQuery.php | 1 + ...habricatorProfileMenuItemConfiguration.php | 4 + 6 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index a70eb1d5ae..6815ddda25 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3476,6 +3476,7 @@ phutil_register_library_map(array( 'PhabricatorProjectPointsProfileMenuItem' => 'applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php', 'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php', 'PhabricatorProjectProfileMenuEngine' => 'applications/project/engine/PhabricatorProjectProfileMenuEngine.php', + 'PhabricatorProjectProfileMenuItem' => 'applications/search/menuitem/PhabricatorProjectProfileMenuItem.php', 'PhabricatorProjectProjectHasMemberEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasMemberEdgeType.php', 'PhabricatorProjectProjectHasObjectEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasObjectEdgeType.php', 'PhabricatorProjectProjectPHIDType' => 'applications/project/phid/PhabricatorProjectProjectPHIDType.php', @@ -8613,6 +8614,7 @@ phutil_register_library_map(array( 'PhabricatorProjectPointsProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorProjectProfileController' => 'PhabricatorProjectController', 'PhabricatorProjectProfileMenuEngine' => 'PhabricatorProfileMenuEngine', + 'PhabricatorProjectProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorProjectProjectHasMemberEdgeType' => 'PhabricatorEdgeType', 'PhabricatorProjectProjectHasObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorProjectProjectPHIDType' => 'PhabricatorPHIDType', diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php index 7126a12ddd..d930b31314 100644 --- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -73,7 +73,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { } $item_id = $request->getURIData('itemID'); - $item_list = $this->loadItems(); + $item_list = $this->getItems(); $selected_item = null; if (strlen($item_id)) { @@ -174,6 +174,18 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->setBaseURI(new PhutilURI($this->getItemURI(''))); $menu_items = $this->getItems(); + $filtered_items = array(); + foreach ($menu_items as $menu_item) { + if ($menu_item->isDisabled()) { + continue; + } + $filtered_items[] = $menu_item; + } + $filtered_groups = mgroup($filtered_items, 'getMenuItemKey'); + foreach ($filtered_groups as $group) { + $first_item = head($group); + $first_item->willBuildNavigationItems($group); + } foreach ($menu_items as $menu_item) { if ($menu_item->isDisabled()) { diff --git a/src/applications/search/menuitem/PhabricatorProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php index f37cab236c..c47d9afe8e 100644 --- a/src/applications/search/menuitem/PhabricatorProfileMenuItem.php +++ b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php @@ -12,6 +12,8 @@ abstract class PhabricatorProfileMenuItem extends Phobject { abstract protected function newNavigationMenuItems( PhabricatorProfileMenuItemConfiguration $config); + public function willBuildNavigationItems(array $items) {} + public function getMenuItemTypeIcon() { return null; } diff --git a/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php new file mode 100644 index 0000000000..002a3fcace --- /dev/null +++ b/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php @@ -0,0 +1,113 @@ +project = $project; + return $this; + } + + public function getProject() { + $project = $this->project; + if (!$project) { + return null; + } else if ($project->isArchived()) { + return null; + } + return $project; + } + + public function willBuildNavigationItems(array $items) { + $viewer = $this->getViewer(); + $project_phids = array(); + foreach ($items as $item) { + $project_phids[] = $item->getMenuItemProperty('project'); + } + + $projects = id(new PhabricatorProjectQuery()) + ->setViewer($viewer) + ->withPHIDs($project_phids) + ->needImages(true) + ->execute(); + + $projects = mpull($projects, null, 'getPHID'); + foreach ($items as $item) { + $project_phid = $item->getMenuItemProperty('project'); + $project = idx($projects, $project_phid, null); + $item->getMenuItem()->attachProject($project); + } + } + + public function getDisplayName( + PhabricatorProfileMenuItemConfiguration $config) { + $project = $this->getProject(); + if (!$project) { + return pht('(Restricted/Invalid Project)'); + } + if (strlen($this->getName($config))) { + return $this->getName($config); + } else { + return $project->getName(); + } + } + + public function buildEditEngineFields( + PhabricatorProfileMenuItemConfiguration $config) { + return array( + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setValue($this->getName($config)), + id(new PhabricatorDatasourceEditField()) + ->setKey('project') + ->setLabel(pht('Project')) + ->setDatasource(new PhabricatorProjectDatasource()) + ->setSingleValue($config->getMenuItemProperty('project')), + ); + } + + private function getName( + PhabricatorProfileMenuItemConfiguration $config) { + return $config->getMenuItemProperty('name'); + } + + protected function newNavigationMenuItems( + PhabricatorProfileMenuItemConfiguration $config) { + + $project = $this->getProject(); + if (!$project) { + return array(); + } + + $picture = $project->getProfileImageURI(); + $name = $this->getDisplayName($config); + $href = $project->getURI(); + + $item = $this->newItem() + ->setHref($href) + ->setName($name) + ->setProfileImage($picture); + + return array( + $item, + ); + } + +} diff --git a/src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php index 2109ee1dbe..f8172638c3 100644 --- a/src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php +++ b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php @@ -66,6 +66,7 @@ final class PhabricatorProfileMenuItemConfigurationQuery unset($page[$key]); continue; } + $item_type = clone $item_type; $item->attachMenuItem($item_type); } diff --git a/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php b/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php index 46aa03e25d..3a9c0effc6 100644 --- a/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php +++ b/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php @@ -118,6 +118,10 @@ final class PhabricatorProfileMenuItemConfiguration return $this->getMenuItem()->shouldEnableForObject($object); } + public function willBuildNavigationItems(array $items) { + return $this->getMenuItem()->willBuildNavigationItems($items); + } + public function getSortKey() { $order = $this->getMenuItemOrder(); if ($order === null) { From 8b7e99f68c977c98f699134dba5da16ad27fca4a Mon Sep 17 00:00:00 2001 From: Aviv Eyal Date: Fri, 16 Dec 2016 00:52:05 +0000 Subject: [PATCH 42/78] Introduce ModularTransactionType::isRenderingTargetExternal Summary: This is just some housekeeping - see note in D16287. Basically, "isTextMode" doesn't convey enough information. Test Plan: `git grep isTextMode | grep -v Remarkup`, and visit all callsites; There are 4 of them left. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17063 --- .../storage/PhabricatorModularTransactionType.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php index 2ae06131f4..2606264778 100644 --- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php +++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php @@ -227,7 +227,7 @@ abstract class PhabricatorModularTransactionType // server's settings, or the user may later refer back to it after // changing timezones. - if ($this->isTextMode()) { + if ($this->isRenderingTargetExternal()) { $offset = $viewer->getTimeZoneOffsetInHours(); if ($offset >= 0) { $display = pht('%s (UTC+%d)', $display, $offset); @@ -277,7 +277,17 @@ abstract class PhabricatorModularTransactionType return !strlen($value); } - protected function isTextMode() { + /** + * When rendering to external targets (Email/Asana/etc), we need to include + * more information that users can't obtain later. + */ + final protected function isRenderingTargetExternal() { + // Right now, this is our best proxy for this: + return $this->isTextMode(); + // "TARGET_TEXT" means "EMail" and "TARGET_HTML" means "Web". + } + + final protected function isTextMode() { $target = $this->getStorage()->getRenderingTarget(); return ($target == PhabricatorApplicationTransaction::TARGET_TEXT); } From 92db64c1b2474b8496e5d939b917294be06feee7 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 15 Dec 2016 21:46:24 -0800 Subject: [PATCH 43/78] Add EditEngine typeahead Summary: Allows you to set forms via typeahead Test Plan: `/typeahead/browse/PhabricatorEditEngineDatasource/` Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17065 --- src/__phutil_library_map__.php | 2 + .../PhabricatorEditEngineDatasource.php | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/applications/transactions/typeahead/PhabricatorEditEngineDatasource.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 6815ddda25..fde4f5fca3 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2572,6 +2572,7 @@ phutil_register_library_map(array( 'PhabricatorEditEngineConfigurationViewController' => 'applications/transactions/controller/PhabricatorEditEngineConfigurationViewController.php', 'PhabricatorEditEngineController' => 'applications/transactions/controller/PhabricatorEditEngineController.php', 'PhabricatorEditEngineCreateQuickActions' => 'applications/settings/quickmenu/PhabricatorEditEngineCreateQuickActions.php', + 'PhabricatorEditEngineDatasource' => 'applications/transactions/typeahead/PhabricatorEditEngineDatasource.php', 'PhabricatorEditEngineExtension' => 'applications/transactions/engineextension/PhabricatorEditEngineExtension.php', 'PhabricatorEditEngineExtensionModule' => 'applications/transactions/engineextension/PhabricatorEditEngineExtensionModule.php', 'PhabricatorEditEngineListController' => 'applications/transactions/controller/PhabricatorEditEngineListController.php', @@ -7551,6 +7552,7 @@ phutil_register_library_map(array( 'PhabricatorEditEngineConfigurationViewController' => 'PhabricatorEditEngineController', 'PhabricatorEditEngineController' => 'PhabricatorApplicationTransactionController', 'PhabricatorEditEngineCreateQuickActions' => 'PhabricatorQuickActions', + 'PhabricatorEditEngineDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorEditEngineExtension' => 'Phobject', 'PhabricatorEditEngineExtensionModule' => 'PhabricatorConfigModule', 'PhabricatorEditEngineListController' => 'PhabricatorEditEngineController', diff --git a/src/applications/transactions/typeahead/PhabricatorEditEngineDatasource.php b/src/applications/transactions/typeahead/PhabricatorEditEngineDatasource.php new file mode 100644 index 0000000000..725716bdaf --- /dev/null +++ b/src/applications/transactions/typeahead/PhabricatorEditEngineDatasource.php @@ -0,0 +1,39 @@ +executeQuery($query); + $results = array(); + foreach ($forms as $form) { + + $result = id(new PhabricatorTypeaheadResult()) + ->setName($form->getName()) + ->setPHID($form->getPHID()); + + if ($form->getIsDisabled()) { + $result->setClosed(pht('Archived')); + } + + $results[] = $result; + } + + return $this->filterResultsAgainstTokens($results); + } + +} From 0387d626325c4ee89e41cffb0c71a2f6ca34a6f1 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 16 Dec 2016 08:41:18 -0800 Subject: [PATCH 44/78] Add Dashboard typeaheads Summary: Builds a basic typeahead for Dashboards and Panels Test Plan: `/typeahead/browse/PhabricatorDashboardPanelDatasource/` Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17064 --- src/__phutil_library_map__.php | 4 ++ .../PhabricatorDashboardDatasource.php | 39 ++++++++++++++++ .../PhabricatorDashboardPanelDatasource.php | 46 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 src/applications/dashboard/typeahead/PhabricatorDashboardDatasource.php create mode 100644 src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index fde4f5fca3..d78746df3a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2448,6 +2448,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php', 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardDashboardHasPanelEdgeType.php', 'PhabricatorDashboardDashboardPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardDashboardPHIDType.php', + 'PhabricatorDashboardDatasource' => 'applications/dashboard/typeahead/PhabricatorDashboardDatasource.php', 'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php', 'PhabricatorDashboardIconSet' => 'applications/dashboard/icon/PhabricatorDashboardIconSet.php', 'PhabricatorDashboardInstall' => 'applications/dashboard/storage/PhabricatorDashboardInstall.php', @@ -2460,6 +2461,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelArchiveController' => 'applications/dashboard/controller/PhabricatorDashboardPanelArchiveController.php', 'PhabricatorDashboardPanelCoreCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelCoreCustomField.php', 'PhabricatorDashboardPanelCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelCustomField.php', + 'PhabricatorDashboardPanelDatasource' => 'applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php', 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'applications/dashboard/conduit/PhabricatorDashboardPanelEditConduitAPIMethod.php', 'PhabricatorDashboardPanelEditController' => 'applications/dashboard/controller/PhabricatorDashboardPanelEditController.php', 'PhabricatorDashboardPanelEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php', @@ -7412,6 +7414,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO', 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'PhabricatorEdgeType', 'PhabricatorDashboardDashboardPHIDType' => 'PhabricatorPHIDType', + 'PhabricatorDashboardDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorDashboardEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardIconSet' => 'PhabricatorIconSet', 'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO', @@ -7434,6 +7437,7 @@ phutil_register_library_map(array( 'PhabricatorStandardCustomFieldInterface', ), 'PhabricatorDashboardPanelCustomField' => 'PhabricatorCustomField', + 'PhabricatorDashboardPanelDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelEditEngine' => 'PhabricatorEditEngine', diff --git a/src/applications/dashboard/typeahead/PhabricatorDashboardDatasource.php b/src/applications/dashboard/typeahead/PhabricatorDashboardDatasource.php new file mode 100644 index 0000000000..a1c0399624 --- /dev/null +++ b/src/applications/dashboard/typeahead/PhabricatorDashboardDatasource.php @@ -0,0 +1,39 @@ +executeQuery($query); + $results = array(); + foreach ($dashboards as $dashboard) { + $result = id(new PhabricatorTypeaheadResult()) + ->setName($dashboard->getName()) + ->setPHID($dashboard->getPHID()) + ->addAttribute(pht('Dashboard')); + + if ($dashboard->isArchived()) { + $result->setClosed(pht('Archived')); + } + + $results[] = $result; + } + + return $this->filterResultsAgainstTokens($results); + } + +} diff --git a/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php new file mode 100644 index 0000000000..35c8c5c212 --- /dev/null +++ b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php @@ -0,0 +1,46 @@ +executeQuery($query); + $results = array(); + foreach ($panels as $panel) { + $impl = $panel->getImplementation(); + if ($impl) { + $type_text = $impl->getPanelTypeName(); + } else { + $type_text = nonempty($panel->getPanelType(), pht('Unknown Type')); + } + + $result = id(new PhabricatorTypeaheadResult()) + ->setName($panel->getName()) + ->setPHID($panel->getPHID()) + ->addAttribute($type_text); + + if ($panel->getIsArchived()) { + $result->setClosed(pht('Archived')); + } + + $results[] = $result; + } + + return $this->filterResultsAgainstTokens($results); + } + +} From 24926f9453e55f0480b36c8bc9b74b46d0c08cce Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 15 Dec 2016 10:11:58 -0800 Subject: [PATCH 45/78] Move Differential commit message rendering to dedicated classes Summary: Ref T11114. This probably still has some bugs, but survives basic sanity checks. Continue pulling commit message logic out of CustomField so we can reduce the amount of responsibility/bloat in the classtree and send more code through EditEngine. Test Plan: - Called `differential.getcommitmessage` via API console for various revisions/parameters (edit and create mode, with and without fields, with and without revisions). - Used `--create`, `--edit` and `--update` modes of `arc diff` from the CLI. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17066 --- src/__phutil_library_map__.php | 10 +- ...entialGetCommitMessageConduitAPIMethod.php | 158 +++++++----------- ...DifferentialAuditorsCommitMessageField.php | 18 +- ...rentialBlameRevisionCommitMessageField.php | 6 +- .../DifferentialCommitMessageCustomField.php | 63 +++++++ .../field/DifferentialCommitMessageField.php | 92 ++++++++++ ...ifferentialConflictsCommitMessageField.php | 8 + ...DifferentialGitSVNIDCommitMessageField.php | 8 + ...fferentialJIRAIssuesCommitMessageField.php | 22 ++- ...fferentialRevertPlanCommitMessageField.php | 6 +- ...fferentialReviewedByCommitMessageField.php | 34 ++++ ...ifferentialReviewersCommitMessageField.php | 48 ++++++ ...fferentialRevisionIDCommitMessageField.php | 27 +++ ...ferentialSubscribersCommitMessageField.php | 21 +++ .../DifferentialSummaryCommitMessageField.php | 8 + .../DifferentialTagsCommitMessageField.php | 30 ++++ .../DifferentialTasksCommitMessageField.php | 29 ++++ ...DifferentialTestPlanCommitMessageField.php | 8 + .../DifferentialTitleCommitMessageField.php | 14 ++ .../storage/DifferentialRevision.php | 1 + 20 files changed, 499 insertions(+), 112 deletions(-) create mode 100644 src/applications/differential/field/DifferentialCommitMessageCustomField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index d78746df3a..798aa49cbe 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -385,6 +385,7 @@ phutil_register_library_map(array( 'DifferentialCloseConduitAPIMethod' => 'applications/differential/conduit/DifferentialCloseConduitAPIMethod.php', 'DifferentialCommentPreviewController' => 'applications/differential/controller/DifferentialCommentPreviewController.php', 'DifferentialCommentSaveController' => 'applications/differential/controller/DifferentialCommentSaveController.php', + 'DifferentialCommitMessageCustomField' => 'applications/differential/field/DifferentialCommitMessageCustomField.php', 'DifferentialCommitMessageField' => 'applications/differential/field/DifferentialCommitMessageField.php', 'DifferentialCommitMessageParser' => 'applications/differential/parser/DifferentialCommitMessageParser.php', 'DifferentialCommitMessageParserTestCase' => 'applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php', @@ -4996,10 +4997,10 @@ phutil_register_library_map(array( 'DifferentialAffectedPath' => 'DifferentialDAO', 'DifferentialApplyPatchField' => 'DifferentialCustomField', 'DifferentialAsanaRepresentationField' => 'DifferentialCustomField', - 'DifferentialAuditorsCommitMessageField' => 'DifferentialCommitMessageField', + 'DifferentialAuditorsCommitMessageField' => 'DifferentialCommitMessageCustomField', 'DifferentialAuditorsField' => 'DifferentialStoredCustomField', 'DifferentialAuthorField' => 'DifferentialCustomField', - 'DifferentialBlameRevisionCommitMessageField' => 'DifferentialCommitMessageField', + 'DifferentialBlameRevisionCommitMessageField' => 'DifferentialCommitMessageCustomField', 'DifferentialBlameRevisionField' => 'DifferentialStoredCustomField', 'DifferentialBlockHeraldAction' => 'HeraldAction', 'DifferentialBlockingReviewerDatasource' => 'PhabricatorTypeaheadCompositeDatasource', @@ -5031,6 +5032,7 @@ phutil_register_library_map(array( 'DifferentialCloseConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialCommentPreviewController' => 'DifferentialController', 'DifferentialCommentSaveController' => 'DifferentialController', + 'DifferentialCommitMessageCustomField' => 'DifferentialCommitMessageField', 'DifferentialCommitMessageField' => 'Phobject', 'DifferentialCommitMessageParser' => 'Phobject', 'DifferentialCommitMessageParserTestCase' => 'PhabricatorTestCase', @@ -5125,7 +5127,7 @@ phutil_register_library_map(array( 'DifferentialInlineCommentMailView' => 'DifferentialMailView', 'DifferentialInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController', 'DifferentialInlineCommentQuery' => 'PhabricatorOffsetPagedQuery', - 'DifferentialJIRAIssuesCommitMessageField' => 'DifferentialCommitMessageField', + 'DifferentialJIRAIssuesCommitMessageField' => 'DifferentialCommitMessageCustomField', 'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField', 'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener', 'DifferentialLandingStrategy' => 'Phobject', @@ -5158,7 +5160,7 @@ phutil_register_library_map(array( 'DifferentialResponsibleDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DifferentialResponsibleUserDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DifferentialResponsibleViewerFunctionDatasource' => 'PhabricatorTypeaheadDatasource', - 'DifferentialRevertPlanCommitMessageField' => 'DifferentialCommitMessageField', + 'DifferentialRevertPlanCommitMessageField' => 'DifferentialCommitMessageCustomField', 'DifferentialRevertPlanField' => 'DifferentialStoredCustomField', 'DifferentialReviewedByCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialReviewedByField' => 'DifferentialCoreCustomField', diff --git a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php index 288a8c4ca9..57dd419790 100644 --- a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php @@ -47,94 +47,71 @@ final class DifferentialGetCommitMessageConduitAPIMethod } } else { $revision = DifferentialRevision::initializeNewRevision($viewer); - $revision->attachReviewerStatus(array()); - $revision->attachActiveDiff(null); } - $is_edit = $request->getValue('edit'); - $is_create = ($is_edit == 'create'); + $edit_mode = $request->getValue('edit'); + $is_create = ($edit_mode == 'create'); + $is_edit = ($edit_mode && !$is_create); - $field_list = PhabricatorCustomField::getObjectFields( - $revision, - ($is_edit - ? DifferentialCustomField::ROLE_COMMITMESSAGEEDIT - : DifferentialCustomField::ROLE_COMMITMESSAGE)); + $field_list = DifferentialCommitMessageField::newEnabledFields($viewer); - $field_list - ->setViewer($viewer) - ->readFieldsFromStorage($revision); - - $field_map = mpull($field_list->getFields(), null, 'getFieldKeyForConduit'); + $custom_storage = $this->loadCustomFieldStorage($viewer, $revision); + foreach ($field_list as $field) { + $field->setCustomFieldStorage($custom_storage); + } + // If we're editing the message, remove fields like "Conflicts" and + // "git-svn-id" which should not be presented to the user for editing. if ($is_edit) { - $fields = $request->getValue('fields', array()); - foreach ($fields as $field => $value) { - $custom_field = idx($field_map, $field); - if (!$custom_field) { - // Just ignore this, these workflows don't make strong distictions - // about field editability on the client side. - continue; - } - if ($is_create || - $custom_field->shouldOverwriteWhenCommitMessageIsEdited()) { - $custom_field->readValueFromCommitMessage($value); + foreach ($field_list as $field_key => $field) { + if (!$field->isFieldEditable()) { + unset($field_list[$field_key]); } } } - $phids = array(); - foreach ($field_list->getFields() as $key => $field) { - $field_phids = $field->getRequiredHandlePHIDsForCommitMessage(); - if (!is_array($field_phids)) { - throw new Exception( - pht( - 'Custom field "%s" was expected to return an array of handle '. - 'PHIDs required for commit message rendering, but returned "%s" '. - 'instead.', - $field->getFieldKey(), - gettype($field_phids))); + $overrides = $request->getValue('fields', array()); + + $value_map = array(); + foreach ($field_list as $field_key => $field) { + if (array_key_exists($field_key, $overrides)) { + $field_value = $overrides[$field_key]; + } else { + $field_value = $field->readFieldValueFromObject($revision); } - $phids[$key] = $field_phids; + + // We're calling this method on the value no matter where we got it + // from, so we hit the same validation logic for values which came over + // the wire and which we generated. + $field_value = $field->readFieldValueFromConduit($field_value); + + $value_map[$field_key] = $field_value; } - $all_phids = array_mergev($phids); - if ($all_phids) { - $all_handles = id(new PhabricatorHandleQuery()) - ->setViewer($viewer) - ->withPHIDs($all_phids) - ->execute(); - } else { - $all_handles = array(); - } - - $key_title = id(new DifferentialTitleField())->getFieldKey(); - $default_title = DifferentialTitleField::getDefaultTitle(); + $key_title = DifferentialTitleCommitMessageField::FIELDKEY; $commit_message = array(); - foreach ($field_list->getFields() as $key => $field) { - $handles = array_select_keys($all_handles, $phids[$key]); + foreach ($field_list as $field_key => $field) { + $label = $field->getFieldName(); + $wire_value = $value_map[$field_key]; + $value = $field->renderFieldValue($wire_value); - $label = $field->renderCommitMessageLabel(); - $value = $field->renderCommitMessageValue($handles); + $is_template = ($is_edit && $field->isTemplateField()); if (!is_string($value) && !is_null($value)) { throw new Exception( pht( - 'Custom field "%s" was expected to render a string or null value, '. - 'but rendered a "%s" instead.', + 'Commit message field "%s" was expected to render a string or '. + 'null value, but rendered a "%s" instead.', $field->getFieldKey(), gettype($value))); } - $is_title = ($key == $key_title); + $is_title = ($field_key == $key_title); if (!strlen($value)) { - if ($is_title) { - $commit_message[] = $default_title; - } else { - if ($is_edit && $field->shouldAppearInCommitMessageTemplate()) { - $commit_message[] = $label.': '; - } + if ($is_template) { + $commit_message[] = $label.': '; } } else { if ($is_title) { @@ -153,46 +130,31 @@ final class DifferentialGetCommitMessageConduitAPIMethod } } - if ($is_edit) { - $tip = $this->getProTip($field_list); - if ($tip !== null) { - $commit_message[] = "\n".$tip; + return implode("\n\n", $commit_message); + } + + private function loadCustomFieldStorage( + PhabricatorUser $viewer, + DifferentialRevision $revision) { + $custom_field_list = PhabricatorCustomField::getObjectFields( + $revision, + DifferentialCustomField::ROLE_COMMITMESSAGE); + $custom_field_list + ->setViewer($viewer) + ->readFieldsFromStorage($revision); + + $custom_field_map = array(); + foreach ($custom_field_list->getFields() as $custom_field) { + if (!$custom_field->shouldUseStorage()) { + continue; } + $custom_field_key = $custom_field->getFieldKey(); + $custom_field_value = $custom_field->getValueForStorage(); + $custom_field_map[$custom_field_key] = $custom_field_value; } - $commit_message = implode("\n\n", $commit_message); - - return $commit_message; + return $custom_field_map; } - private function getProTip() { - // Any field can provide tips, whether it normally appears on commit - // messages or not. - $field_list = PhabricatorCustomField::getObjectFields( - new DifferentialRevision(), - PhabricatorCustomField::ROLE_DEFAULT); - - $tips = array(); - foreach ($field_list->getFields() as $key => $field) { - $tips[] = $field->getProTips(); - } - $tips = array_mergev($tips); - - if (!$tips) { - return null; - } - - shuffle($tips); - - $tip = pht('Tip: %s', head($tips)); - $tip = wordwrap($tip, 78, "\n", true); - - $lines = explode("\n", $tip); - foreach ($lines as $key => $line) { - $lines[$key] = '# '.$line; - } - - return implode("\n", $lines); - } } diff --git a/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php b/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php index fc3bc95fd3..2ff430416d 100644 --- a/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php +++ b/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php @@ -1,7 +1,7 @@ readStringListFieldValueFromConduit($value); + } + + public function renderFieldValue($value) { + return $this->renderHandleList($value); + } + + protected function readFieldValueFromCustomFieldStorage($value) { + return $this->readJSONFieldValueFromCustomFieldStorage($value, array()); + } + } diff --git a/src/applications/differential/field/DifferentialBlameRevisionCommitMessageField.php b/src/applications/differential/field/DifferentialBlameRevisionCommitMessageField.php index d48088c68f..feb17b16c9 100644 --- a/src/applications/differential/field/DifferentialBlameRevisionCommitMessageField.php +++ b/src/applications/differential/field/DifferentialBlameRevisionCommitMessageField.php @@ -1,7 +1,7 @@ isCustomFieldEnabled('phabricator:blame-revision'); + public function getCustomFieldKey() { + return 'phabricator:blame-revision'; } } diff --git a/src/applications/differential/field/DifferentialCommitMessageCustomField.php b/src/applications/differential/field/DifferentialCommitMessageCustomField.php new file mode 100644 index 0000000000..8e7e81739e --- /dev/null +++ b/src/applications/differential/field/DifferentialCommitMessageCustomField.php @@ -0,0 +1,63 @@ +getCustomFieldKey(); + return 100000 + $this->getCustomFieldOrder($custom_key); + } + + public function isFieldEnabled() { + $custom_key = $this->getCustomFieldKey(); + return $this->isCustomFieldEnabled($custom_key); + } + + public function readFieldValueFromObject(DifferentialRevision $revision) { + $custom_key = $this->getCustomFieldKey(); + $value = $this->readCustomFieldValue($revision, $custom_key); + return $value; + } + + protected function readFieldValueFromCustomFieldStorage($value) { + return $value; + } + + protected function readJSONFieldValueFromCustomFieldStorage( + $value, + $default) { + try { + return phutil_json_decode($value); + } catch (PhutilJSONParserException $ex) { + return $default; + } + } + + protected function readCustomFieldValue( + DifferentialRevision $revision, + $key) { + $value = idx($this->getCustomFieldStorage(), $key); + return $this->readFieldValueFromCustomFieldStorage($value); + } + + protected function getCustomFieldOrder($key) { + $field_list = PhabricatorCustomField::getObjectFields( + new DifferentialRevision(), + DifferentialCustomField::ROLE_COMMITMESSAGE); + + $fields = $field_list->getFields(); + + $idx = 0; + foreach ($fields as $field_key => $value) { + if ($key === $field_key) { + return $idx; + } + $idx++; + } + + return $idx; + } + +} diff --git a/src/applications/differential/field/DifferentialCommitMessageField.php b/src/applications/differential/field/DifferentialCommitMessageField.php index ddf5cc5b28..81ffd0fd2e 100644 --- a/src/applications/differential/field/DifferentialCommitMessageField.php +++ b/src/applications/differential/field/DifferentialCommitMessageField.php @@ -4,6 +4,7 @@ abstract class DifferentialCommitMessageField extends Phobject { private $viewer; + private $customFieldStorage; final public function setViewer(PhabricatorUser $viewer) { $this->viewer = $viewer; @@ -14,7 +15,17 @@ abstract class DifferentialCommitMessageField return $this->viewer; } + final public function setCustomFieldStorage(array $custom_field_storage) { + $this->customFieldStorage = $custom_field_storage; + return $this; + } + + final public function getCustomFieldStorage() { + return $this->customFieldStorage; + } + abstract public function getFieldName(); + abstract public function getFieldOrder(); public function isFieldEnabled() { return true; @@ -32,6 +43,30 @@ abstract class DifferentialCommitMessageField return $value; } + public function isFieldEditable() { + return true; + } + + public function isTemplateField() { + return true; + } + + public function readFieldValueFromConduit($value) { + return $this->readStringFieldValueFromConduit($value); + } + + public function readFieldValueFromObject(DifferentialRevision $revision) { + return null; + } + + public function renderFieldValue($value) { + if (!strlen($value)) { + return null; + } + + return $value; + } + final public function getCommitMessageFieldKey() { return $this->getPhobjectClassConstant('FIELDKEY', 64); } @@ -55,6 +90,7 @@ abstract class DifferentialCommitMessageField return id(new PhutilClassMapQuery()) ->setAncestorClass(__CLASS__) ->setUniqueMethod('getCommitMessageFieldKey') + ->setSortMethod('getFieldOrder') ->execute(); } @@ -80,6 +116,62 @@ abstract class DifferentialCommitMessageField ->execute(); } + protected function renderHandleList(array $phids, array $suffixes = array()) { + if (!$phids) { + return null; + } + + $handles = $this->getViewer()->loadHandles($phids); + + $out = array(); + foreach ($handles as $handle) { + $phid = $handle->getPHID(); + + if ($handle->getPolicyFiltered()) { + $token = $phid; + } else if ($handle->isComplete()) { + $token = $handle->getCommandLineObjectName(); + } + + $suffix = idx($suffixes, $phid); + $token = $token.$suffix; + + $out[] = $token; + } + + return implode(', ', $out); + } + + protected function readStringFieldValueFromConduit($value) { + if ($value === null) { + return $value; + } + + if (!is_string($value)) { + throw new Exception( + pht( + 'Field "%s" expects a string value, but received a value of type '. + '"%s".', + $this->getCommitMessageFieldKey(), + gettype($value))); + } + + return $value; + } + + protected function readStringListFieldValueFromConduit($value) { + if (!is_array($value)) { + throw new Exception( + pht( + 'Field "%s" expects a list of strings, but received a value of type '. + '"%s".', + $this->getCommitMessageFieldKey(), + gettype($value))); + } + + return $value; + } + protected function isCustomFieldEnabled($key) { $field_list = PhabricatorCustomField::getObjectFields( new DifferentialRevision(), diff --git a/src/applications/differential/field/DifferentialConflictsCommitMessageField.php b/src/applications/differential/field/DifferentialConflictsCommitMessageField.php index 334a7a060f..360b799b34 100644 --- a/src/applications/differential/field/DifferentialConflictsCommitMessageField.php +++ b/src/applications/differential/field/DifferentialConflictsCommitMessageField.php @@ -9,4 +9,12 @@ final class DifferentialConflictsCommitMessageField return pht('Conflicts'); } + public function getFieldOrder() { + return 900000; + } + + public function isFieldEditable() { + return false; + } + } diff --git a/src/applications/differential/field/DifferentialGitSVNIDCommitMessageField.php b/src/applications/differential/field/DifferentialGitSVNIDCommitMessageField.php index 603b9cce22..786f05a2c3 100644 --- a/src/applications/differential/field/DifferentialGitSVNIDCommitMessageField.php +++ b/src/applications/differential/field/DifferentialGitSVNIDCommitMessageField.php @@ -9,4 +9,12 @@ final class DifferentialGitSVNIDCommitMessageField return pht('git-svn-id'); } + public function getFieldOrder() { + return 900001; + } + + public function isFieldEditable() { + return false; + } + } diff --git a/src/applications/differential/field/DifferentialJIRAIssuesCommitMessageField.php b/src/applications/differential/field/DifferentialJIRAIssuesCommitMessageField.php index f57566cbde..d8cf607735 100644 --- a/src/applications/differential/field/DifferentialJIRAIssuesCommitMessageField.php +++ b/src/applications/differential/field/DifferentialJIRAIssuesCommitMessageField.php @@ -1,7 +1,7 @@ readJSONFieldValueFromCustomFieldStorage($value, array()); + } + + public function readFieldValueFromConduit($value) { + return $this->readStringListFieldValueFromConduit($value); + } + + public function renderFieldValue($value) { + if (!$value) { + return null; + } + + return implode(', ', $value); } } diff --git a/src/applications/differential/field/DifferentialRevertPlanCommitMessageField.php b/src/applications/differential/field/DifferentialRevertPlanCommitMessageField.php index 9f79266d4e..0a813130f9 100644 --- a/src/applications/differential/field/DifferentialRevertPlanCommitMessageField.php +++ b/src/applications/differential/field/DifferentialRevertPlanCommitMessageField.php @@ -1,7 +1,7 @@ isCustomFieldEnabled('phabricator:revert-plan'); + public function getCustomFieldKey() { + return 'phabricator:revert-plan'; } } diff --git a/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php b/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php index ea222b28aa..9c8bf5fb40 100644 --- a/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php +++ b/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php @@ -9,6 +9,10 @@ final class DifferentialReviewedByCommitMessageField return pht('Reviewed By'); } + public function getFieldOrder() { + return 5000; + } + public function parseFieldValue($value) { return $this->parseObjectList( $value, @@ -19,4 +23,34 @@ final class DifferentialReviewedByCommitMessageField $allow_partial = true); } + public function isFieldEditable() { + return false; + } + + public function readFieldValueFromObject(DifferentialRevision $revision) { + if (!$revision->getPHID()) { + return array(); + } + + $phids = array(); + foreach ($revision->getReviewerStatus() as $reviewer) { + switch ($reviewer->getStatus()) { + case DifferentialReviewerStatus::STATUS_ACCEPTED: + case DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER: + $phids[] = $reviewer->getReviewerPHID(); + break; + } + } + + return $phids; + } + + public function readFieldValueFromConduit($value) { + return $this->readStringListFieldValueFromConduit($value); + } + + public function renderFieldValue($value) { + return $this->renderHandleList($value); + } + } diff --git a/src/applications/differential/field/DifferentialReviewersCommitMessageField.php b/src/applications/differential/field/DifferentialReviewersCommitMessageField.php index e3c275b471..fd55d8f06d 100644 --- a/src/applications/differential/field/DifferentialReviewersCommitMessageField.php +++ b/src/applications/differential/field/DifferentialReviewersCommitMessageField.php @@ -9,6 +9,10 @@ final class DifferentialReviewersCommitMessageField return pht('Reviewers'); } + public function getFieldOrder() { + return 4000; + } + public function getFieldAliases() { return array( 'Reviewer', @@ -29,6 +33,50 @@ final class DifferentialReviewersCommitMessageField return $this->flattenReviewers($results); } + public function readFieldValueFromConduit($value) { + return $this->readStringListFieldValueFromConduit($value); + } + + public function readFieldValueFromObject(DifferentialRevision $revision) { + if (!$revision->getPHID()) { + return array(); + } + + $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; + + $results = array(); + foreach ($revision->getReviewerStatus() as $reviewer) { + if ($reviewer->getStatus() == $status_blocking) { + $suffixes = array('!' => '!'); + } else { + $suffixes = array(); + } + + $results[] = array( + 'phid' => $reviewer->getReviewerPHID(), + 'suffixes' => $suffixes, + ); + } + + return $this->flattenReviewers($results); + } + + public function renderFieldValue($value) { + $value = $this->inflateReviewers($value); + + $phid_list = array(); + $suffix_map = array(); + foreach ($value as $reviewer) { + $phid = $reviewer['phid']; + $phid_list[] = $phid; + if (isset($reviewer['suffixes']['!'])) { + $suffix_map[$phid] = '!'; + } + } + + return $this->renderHandleList($phid_list, $suffix_map); + } + private function flattenReviewers(array $values) { // NOTE: For now, `arc` relies on this field returning only scalars, so we // need to reduce the results into scalars. See T10981. diff --git a/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php b/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php index 5e2b378e12..c440a5d4c8 100644 --- a/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php +++ b/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php @@ -9,6 +9,14 @@ final class DifferentialRevisionIDCommitMessageField return pht('Differential Revision'); } + public function getFieldOrder() { + return 200000; + } + + public function isTemplateField() { + return false; + } + public function parseFieldValue($value) { // If the value is just "D123" or similar, parse the ID from it directly. $value = trim($value); @@ -49,4 +57,23 @@ final class DifferentialRevisionIDCommitMessageField return null; } + public function readFieldValueFromObject(DifferentialRevision $revision) { + return $revision->getID(); + } + + public function readFieldValueFromConduit($value) { + if (is_int($value)) { + $value = (string)$value; + } + return $this->readStringFieldValueFromConduit($value); + } + + public function renderFieldValue($value) { + if (!strlen($value)) { + return null; + } + + return PhabricatorEnv::getProductionURI('/D'.$value); + } + } diff --git a/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php b/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php index ba693a3493..713dc9d3ed 100644 --- a/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php +++ b/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php @@ -9,6 +9,10 @@ final class DifferentialSubscribersCommitMessageField return pht('Subscribers'); } + public function getFieldOrder() { + return 6000; + } + public function getFieldAliases() { return array( 'CC', @@ -27,4 +31,21 @@ final class DifferentialSubscribersCommitMessageField )); } + public function readFieldValueFromObject(DifferentialRevision $revision) { + if (!$revision->getPHID()) { + return array(); + } + + return PhabricatorSubscribersQuery::loadSubscribersForPHID( + $revision->getPHID()); + } + + public function readFieldValueFromConduit($value) { + return $this->readStringListFieldValueFromConduit($value); + } + + public function renderFieldValue($value) { + return $this->renderHandleList($value); + } + } diff --git a/src/applications/differential/field/DifferentialSummaryCommitMessageField.php b/src/applications/differential/field/DifferentialSummaryCommitMessageField.php index 531d542633..2689205fbe 100644 --- a/src/applications/differential/field/DifferentialSummaryCommitMessageField.php +++ b/src/applications/differential/field/DifferentialSummaryCommitMessageField.php @@ -9,4 +9,12 @@ final class DifferentialSummaryCommitMessageField return pht('Summary'); } + public function getFieldOrder() { + return 2000; + } + + public function readFieldValueFromObject(DifferentialRevision $revision) { + return $revision->getSummary(); + } + } diff --git a/src/applications/differential/field/DifferentialTagsCommitMessageField.php b/src/applications/differential/field/DifferentialTagsCommitMessageField.php index 7b22df06aa..bd03ba639e 100644 --- a/src/applications/differential/field/DifferentialTagsCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTagsCommitMessageField.php @@ -9,6 +9,10 @@ final class DifferentialTagsCommitMessageField return pht('Tags'); } + public function getFieldOrder() { + return 7000; + } + public function getFieldAliases() { return array( 'Tag', @@ -17,6 +21,10 @@ final class DifferentialTagsCommitMessageField ); } + public function isTemplateField() { + return false; + } + public function parseFieldValue($value) { return $this->parseObjectList( $value, @@ -25,4 +33,26 @@ final class DifferentialTagsCommitMessageField )); } + public function readFieldValueFromObject(DifferentialRevision $revision) { + if (!$revision->getPHID()) { + return array(); + } + + $projects = PhabricatorEdgeQuery::loadDestinationPHIDs( + $revision->getPHID(), + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); + $projects = array_reverse($projects); + + return $projects; + } + + public function readFieldValueFromConduit($value) { + return $this->readStringListFieldValueFromConduit($value); + } + + public function renderFieldValue($value) { + return $this->renderHandleList($value); + } + + } diff --git a/src/applications/differential/field/DifferentialTasksCommitMessageField.php b/src/applications/differential/field/DifferentialTasksCommitMessageField.php index 652de0ffe6..7e0224fbbc 100644 --- a/src/applications/differential/field/DifferentialTasksCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTasksCommitMessageField.php @@ -9,6 +9,10 @@ final class DifferentialTasksCommitMessageField return pht('Maniphest Tasks'); } + public function getFieldOrder() { + return 8000; + } + public function getFieldAliases() { return array( 'Task', @@ -17,6 +21,10 @@ final class DifferentialTasksCommitMessageField ); } + public function isTemplateField() { + return false; + } + public function parseFieldValue($value) { return $this->parseObjectList( $value, @@ -25,4 +33,25 @@ final class DifferentialTasksCommitMessageField )); } + public function readFieldValueFromObject(DifferentialRevision $revision) { + if (!$revision->getPHID()) { + return array(); + } + + $projects = PhabricatorEdgeQuery::loadDestinationPHIDs( + $revision->getPHID(), + DifferentialRevisionHasTaskEdgeType::EDGECONST); + $projects = array_reverse($projects); + + return $projects; + } + + public function readFieldValueFromConduit($value) { + return $this->readStringListFieldValueFromConduit($value); + } + + public function renderFieldValue($value) { + return $this->renderHandleList($value); + } + } diff --git a/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php b/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php index d9f1a3e3b6..e915d5932d 100644 --- a/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php @@ -9,6 +9,10 @@ final class DifferentialTestPlanCommitMessageField return pht('Test Plan'); } + public function getFieldOrder() { + return 3000; + } + public function getFieldAliases() { return array( 'Testplan', @@ -33,4 +37,8 @@ final class DifferentialTestPlanCommitMessageField } } + public function readFieldValueFromObject(DifferentialRevision $revision) { + return $revision->getTestPlan(); + } + } diff --git a/src/applications/differential/field/DifferentialTitleCommitMessageField.php b/src/applications/differential/field/DifferentialTitleCommitMessageField.php index af5ed58545..cb481900a5 100644 --- a/src/applications/differential/field/DifferentialTitleCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTitleCommitMessageField.php @@ -9,6 +9,10 @@ final class DifferentialTitleCommitMessageField return pht('Title'); } + public function getFieldOrder() { + return 1000; + } + public static function getDefaultTitle() { return pht('<'); } @@ -33,4 +37,14 @@ final class DifferentialTitleCommitMessageField } } + public function readFieldValueFromObject(DifferentialRevision $revision) { + $value = $revision->getTitle(); + + if (!strlen($value)) { + return self::getDefaultTitle(); + } + + return $value; + } + } diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index b6ed1994cc..09e6cf932c 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -70,6 +70,7 @@ final class DifferentialRevision extends DifferentialDAO ->setAuthorPHID($actor->getPHID()) ->attachRelationships(array()) ->attachRepository(null) + ->attachActiveDiff(null) ->attachReviewerStatus(array()) ->setStatus(ArcanistDifferentialRevisionStatus::NEEDS_REVIEW); } From 64509dcca7be680ce3c85c8d0269bc515907ab3f Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 04:45:55 -0800 Subject: [PATCH 46/78] Drive CLI-based revision edits through "differential.revision.edit" API + EditEngine Summary: Ref T11114. This creates `differential.revision.edit` (a modern, v3 API method) and redefines the existing methods in terms of it. Both `differential.createrevision` and `differential.updaterevision` are now internally implemented by building a `differential.revision.edit` API call and then executing it. I //think// this covers everything except custom fields, which need some tweaking to work with EditEngine. I'll clean that up in the next change. Test Plan: - Created, updated, and edited revisions via `arc`. - Called APIs manually via test console. - Stored custom fields ("Blame Rev", "Revert Plan") aren't exposed yet. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17067 --- src/__phutil_library_map__.php | 2 + .../conduit/DifferentialConduitAPIMethod.php | 88 ++++++------------- ...erentialCreateRevisionConduitAPIMethod.php | 8 +- ...entialGetCommitMessageConduitAPIMethod.php | 12 ++- ...fferentialRevisionEditConduitAPIMethod.php | 18 ++++ .../editor/DifferentialRevisionEditEngine.php | 39 ++++---- .../DifferentialCommitMessageCustomField.php | 5 ++ .../field/DifferentialCommitMessageField.php | 7 ++ ...ifferentialConflictsCommitMessageField.php | 4 + ...DifferentialGitSVNIDCommitMessageField.php | 4 + ...fferentialReviewedByCommitMessageField.php | 4 + ...ifferentialReviewersCommitMessageField.php | 24 +++++ ...fferentialRevisionIDCommitMessageField.php | 4 + ...ferentialSubscribersCommitMessageField.php | 9 ++ .../DifferentialSummaryCommitMessageField.php | 9 ++ .../DifferentialTagsCommitMessageField.php | 8 ++ .../DifferentialTasksCommitMessageField.php | 4 + ...DifferentialTestPlanCommitMessageField.php | 9 ++ .../DifferentialTitleCommitMessageField.php | 9 ++ ...fferentialRevisionReviewersTransaction.php | 13 ++- ...DifferentialRevisionSummaryTransaction.php | 1 + ...ifferentialRevisionTestPlanTransaction.php | 1 + .../DifferentialRevisionTitleTransaction.php | 1 + ...PhabricatorProjectsEditEngineExtension.php | 10 ++- ...icatorSubscriptionsEditEngineExtension.php | 10 ++- .../PhabricatorCommentEditEngineExtension.php | 3 +- .../PhabricatorTypeaheadDatasource.php | 23 ++++- 27 files changed, 231 insertions(+), 98 deletions(-) create mode 100644 src/applications/differential/conduit/DifferentialRevisionEditConduitAPIMethod.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 798aa49cbe..c89c4733c5 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -527,6 +527,7 @@ phutil_register_library_map(array( 'DifferentialRevisionControlSystem' => 'applications/differential/constants/DifferentialRevisionControlSystem.php', 'DifferentialRevisionDependedOnByRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependedOnByRevisionEdgeType.php', 'DifferentialRevisionDependsOnRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependsOnRevisionEdgeType.php', + 'DifferentialRevisionEditConduitAPIMethod' => 'applications/differential/conduit/DifferentialRevisionEditConduitAPIMethod.php', 'DifferentialRevisionEditEngine' => 'applications/differential/editor/DifferentialRevisionEditEngine.php', 'DifferentialRevisionEditProController' => 'applications/differential/controller/DifferentialRevisionEditProController.php', 'DifferentialRevisionFulltextEngine' => 'applications/differential/search/DifferentialRevisionFulltextEngine.php', @@ -5203,6 +5204,7 @@ phutil_register_library_map(array( 'DifferentialRevisionControlSystem' => 'Phobject', 'DifferentialRevisionDependedOnByRevisionEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionDependsOnRevisionEdgeType' => 'PhabricatorEdgeType', + 'DifferentialRevisionEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'DifferentialRevisionEditEngine' => 'PhabricatorEditEngine', 'DifferentialRevisionEditProController' => 'DifferentialController', 'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine', diff --git a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php index 111e0f04b4..34843b5609 100644 --- a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php @@ -53,21 +53,16 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod { $viewer = $request->getUser(); - $field_list = PhabricatorCustomField::getObjectFields( - $revision, - DifferentialCustomField::ROLE_COMMITMESSAGEEDIT); - - $field_list - ->setViewer($viewer) - ->readFieldsFromStorage($revision); - $field_map = mpull($field_list->getFields(), null, 'getFieldKeyForConduit'); + // We're going to build the body of a "differential.revision.edit" API + // request, then just call that code directly. $xactions = array(); + $xactions[] = array( + 'type' => DifferentialRevisionEditEngine::KEY_UPDATE, + 'value' => $diff->getPHID(), + ); - $xactions[] = id(new DifferentialTransaction()) - ->setTransactionType(DifferentialTransaction::TYPE_UPDATE) - ->setNewValue($diff->getPHID()); - + $field_map = DifferentialCommitMessageField::newEnabledFields($viewer); $values = $request->getValue('fields', array()); foreach ($values as $key => $value) { $field = idx($field_map, $key); @@ -79,53 +74,20 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod { continue; } - $role = PhabricatorCustomField::ROLE_APPLICATIONTRANSACTIONS; - if (!$field->shouldEnableForRole($role)) { - continue; - } - - // TODO: This is fairly similar to PhabricatorCustomField's - // buildFieldTransactionsFromRequest() method, but that's currently not - // easy to reuse. - - $transaction_type = $field->getApplicationTransactionType(); - $xaction = id(new DifferentialTransaction()) - ->setTransactionType($transaction_type); - - if ($transaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) { - // For TYPE_CUSTOMFIELD transactions only, we provide the old value - // as an input. - $old_value = $field->getOldValueForApplicationTransactions(); - $xaction->setOldValue($old_value); - } - // The transaction itself will be validated so this is somewhat // redundant, but this validator will sometimes give us a better error // message or a better reaction to a bad value type. - $field->validateCommitMessageValue($value); - $field->readValueFromCommitMessage($value); + $value = $field->readFieldValueFromConduit($value); - $xaction - ->setNewValue($field->getNewValueForApplicationTransactions()); - - if ($transaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) { - // For TYPE_CUSTOMFIELD transactions, add the field key in metadata. - $xaction->setMetadataValue('customfield:key', $field->getFieldKey()); + foreach ($field->getFieldTransactions($value) as $xaction) { + $xactions[] = $xaction; } - - $metadata = $field->getApplicationTransactionMetadata(); - foreach ($metadata as $meta_key => $meta_value) { - $xaction->setMetadataValue($meta_key, $meta_value); - } - - $xactions[] = $xaction; } $message = $request->getValue('message'); if (strlen($message)) { - // This is a little awkward, and should maybe move inside the transaction - // editor. It largely exists for legacy reasons. See some discussion in - // T7899. + // This is a little awkward, and should move elsewhere or be removed. It + // largely exists for legacy reasons. See some discussion in T7899. $first_line = head(phutil_split_lines($message, false)); $first_line = id(new PhutilUTF8StringTruncator()) @@ -136,20 +98,24 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod { $diff->setDescription($first_line); $diff->save(); - $xactions[] = id(new DifferentialTransaction()) - ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) - ->attachComment( - id(new DifferentialTransactionComment()) - ->setContent($message)); + $xactions[] = array( + 'type' => PhabricatorCommentEditEngineExtension::EDITKEY, + 'value' => $message, + ); } - $editor = id(new DifferentialTransactionEditor()) - ->setActor($viewer) - ->setContentSource($request->newContentSource()) - ->setContinueOnNoEffect(true) - ->setContinueOnMissingFields(true); + $method = 'differential.revision.edit'; + $params = array( + 'transactions' => $xactions, + ); - $editor->applyTransactions($revision, $xactions); + if ($revision->getID()) { + $params['objectIdentifier'] = $revision->getID(); + } + + return id(new ConduitCall($method, $params, $strict = true)) + ->setUser($viewer) + ->execute(); } protected function loadCustomFieldsForRevisions( diff --git a/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php index 95b4309c70..371d57cd9c 100644 --- a/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php @@ -45,16 +45,18 @@ final class DifferentialCreateRevisionConduitAPIMethod $revision = DifferentialRevision::initializeNewRevision($viewer); $revision->attachReviewerStatus(array()); - $this->applyFieldEdit( + $result = $this->applyFieldEdit( $request, $revision, $diff, $request->getValue('fields', array()), $message = null); + $revision_id = $result['object']['id']; + return array( - 'revisionid' => $revision->getID(), - 'uri' => PhabricatorEnv::getURI('/D'.$revision->getID()), + 'revisionid' => $revision_id, + 'uri' => PhabricatorEnv::getURI('/D'.$revision_id), ); } diff --git a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php index 57dd419790..2c5c936679 100644 --- a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php @@ -49,9 +49,15 @@ final class DifferentialGetCommitMessageConduitAPIMethod $revision = DifferentialRevision::initializeNewRevision($viewer); } + // There are three modes here: "edit", "create", and "read" (which has + // no value for the "edit" parameter). + + // In edit or create mode, we hide read-only fields. In create mode, we + // show "Field:" templates for some fields even if they are empty. $edit_mode = $request->getValue('edit'); + + $is_any_edit = (bool)strlen($edit_mode); $is_create = ($edit_mode == 'create'); - $is_edit = ($edit_mode && !$is_create); $field_list = DifferentialCommitMessageField::newEnabledFields($viewer); @@ -62,7 +68,7 @@ final class DifferentialGetCommitMessageConduitAPIMethod // If we're editing the message, remove fields like "Conflicts" and // "git-svn-id" which should not be presented to the user for editing. - if ($is_edit) { + if ($is_any_edit) { foreach ($field_list as $field_key => $field) { if (!$field->isFieldEditable()) { unset($field_list[$field_key]); @@ -96,7 +102,7 @@ final class DifferentialGetCommitMessageConduitAPIMethod $wire_value = $value_map[$field_key]; $value = $field->renderFieldValue($wire_value); - $is_template = ($is_edit && $field->isTemplateField()); + $is_template = ($is_create && $field->isTemplateField()); if (!is_string($value) && !is_null($value)) { throw new Exception( diff --git a/src/applications/differential/conduit/DifferentialRevisionEditConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialRevisionEditConduitAPIMethod.php new file mode 100644 index 0000000000..cb7c7e2e93 --- /dev/null +++ b/src/applications/differential/conduit/DifferentialRevisionEditConduitAPIMethod.php @@ -0,0 +1,18 @@ +setKey('update') - ->setLabel(pht('Update Diff')) - ->setDescription(pht('New diff to create or update the revision with.')) - ->setConduitDescription(pht('Create or update a revision with a diff.')) - ->setConduitTypeDescription(pht('PHID of the diff.')) - ->setTransactionType(DifferentialTransaction::TYPE_UPDATE) - ->setHandleParameterType(new AphrontPHIDListHTTPParameterType()) - ->setSingleValue($diff_phid) - ->setIsReorderable(false) - ->setIsDefaultable(false) - ->setIsInvisible(true) - ->setIsLockable(false); - } + $fields[] = id(new PhabricatorHandlesEditField()) + ->setKey(self::KEY_UPDATE) + ->setLabel(pht('Update Diff')) + ->setDescription(pht('New diff to create or update the revision with.')) + ->setConduitDescription(pht('Create or update a revision with a diff.')) + ->setConduitTypeDescription(pht('PHID of the diff.')) + ->setTransactionType(DifferentialTransaction::TYPE_UPDATE) + ->setHandleParameterType(new AphrontPHIDListHTTPParameterType()) + ->setSingleValue($diff_phid) + ->setIsConduitOnly(!$diff) + ->setIsReorderable(false) + ->setIsDefaultable(false) + ->setIsInvisible(true) + ->setIsLockable(false); if ($is_update) { $fields[] = id(new PhabricatorInstructionsEditField()) @@ -134,7 +135,7 @@ final class DifferentialRevisionEditEngine } $fields[] = id(new PhabricatorTextEditField()) - ->setKey('title') + ->setKey(DifferentialRevisionTitleTransaction::EDITKEY) ->setLabel(pht('Title')) ->setIsRequired(true) ->setTransactionType( @@ -145,7 +146,7 @@ final class DifferentialRevisionEditEngine ->setValue($object->getTitle()); $fields[] = id(new PhabricatorRemarkupEditField()) - ->setKey('summary') + ->setKey(DifferentialRevisionSummaryTransaction::EDITKEY) ->setLabel(pht('Summary')) ->setTransactionType( DifferentialRevisionSummaryTransaction::TRANSACTIONTYPE) @@ -156,7 +157,7 @@ final class DifferentialRevisionEditEngine if ($plan_enabled) { $fields[] = id(new PhabricatorRemarkupEditField()) - ->setKey('testPlan') + ->setKey(DifferentialRevisionTestPlanTransaction::EDITKEY) ->setLabel(pht('Test Plan')) ->setIsRequired($plan_required) ->setTransactionType( @@ -169,7 +170,7 @@ final class DifferentialRevisionEditEngine } $fields[] = id(new PhabricatorDatasourceEditField()) - ->setKey('reviewerPHIDs') + ->setKey(DifferentialRevisionReviewersTransaction::EDITKEY) ->setLabel(pht('Reviewers')) ->setDatasource(new DifferentialReviewerDatasource()) ->setUseEdgeTransactions(true) diff --git a/src/applications/differential/field/DifferentialCommitMessageCustomField.php b/src/applications/differential/field/DifferentialCommitMessageCustomField.php index 8e7e81739e..b53b8d3147 100644 --- a/src/applications/differential/field/DifferentialCommitMessageCustomField.php +++ b/src/applications/differential/field/DifferentialCommitMessageCustomField.php @@ -60,4 +60,9 @@ abstract class DifferentialCommitMessageCustomField return $idx; } + public function getFieldTransactions($value) { + // TODO: Implement this! + return array(); + } + } diff --git a/src/applications/differential/field/DifferentialCommitMessageField.php b/src/applications/differential/field/DifferentialCommitMessageField.php index 81ffd0fd2e..6e3a0dbbd9 100644 --- a/src/applications/differential/field/DifferentialCommitMessageField.php +++ b/src/applications/differential/field/DifferentialCommitMessageField.php @@ -67,6 +67,13 @@ abstract class DifferentialCommitMessageField return $value; } + public function getFieldTransactions($value) { + if (!$this->isFieldEditable()) { + return array(); + } + throw new PhutilMethodNotImplementedException(); + } + final public function getCommitMessageFieldKey() { return $this->getPhobjectClassConstant('FIELDKEY', 64); } diff --git a/src/applications/differential/field/DifferentialConflictsCommitMessageField.php b/src/applications/differential/field/DifferentialConflictsCommitMessageField.php index 360b799b34..5a4c281157 100644 --- a/src/applications/differential/field/DifferentialConflictsCommitMessageField.php +++ b/src/applications/differential/field/DifferentialConflictsCommitMessageField.php @@ -17,4 +17,8 @@ final class DifferentialConflictsCommitMessageField return false; } + public function isTemplateField() { + return false; + } + } diff --git a/src/applications/differential/field/DifferentialGitSVNIDCommitMessageField.php b/src/applications/differential/field/DifferentialGitSVNIDCommitMessageField.php index 786f05a2c3..c4b84afc12 100644 --- a/src/applications/differential/field/DifferentialGitSVNIDCommitMessageField.php +++ b/src/applications/differential/field/DifferentialGitSVNIDCommitMessageField.php @@ -17,4 +17,8 @@ final class DifferentialGitSVNIDCommitMessageField return false; } + public function isTemplateField() { + return false; + } + } diff --git a/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php b/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php index 9c8bf5fb40..523697b1e7 100644 --- a/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php +++ b/src/applications/differential/field/DifferentialReviewedByCommitMessageField.php @@ -27,6 +27,10 @@ final class DifferentialReviewedByCommitMessageField return false; } + public function isTemplateField() { + return false; + } + public function readFieldValueFromObject(DifferentialRevision $revision) { if (!$revision->getPHID()) { return array(); diff --git a/src/applications/differential/field/DifferentialReviewersCommitMessageField.php b/src/applications/differential/field/DifferentialReviewersCommitMessageField.php index fd55d8f06d..0f110b6e3a 100644 --- a/src/applications/differential/field/DifferentialReviewersCommitMessageField.php +++ b/src/applications/differential/field/DifferentialReviewersCommitMessageField.php @@ -77,6 +77,30 @@ final class DifferentialReviewersCommitMessageField return $this->renderHandleList($phid_list, $suffix_map); } + public function getFieldTransactions($value) { + $value = $this->inflateReviewers($value); + + $reviewer_list = array(); + foreach ($value as $reviewer) { + $phid = $reviewer['phid']; + if (isset($reviewer['suffixes']['!'])) { + $reviewer_list[] = 'blocking('.$phid.')'; + } else { + $reviewer_list[] = $phid; + } + } + + $xaction_key = DifferentialRevisionReviewersTransaction::EDITKEY; + $xaction_type = "{$xaction_key}.set"; + + return array( + array( + 'type' => $xaction_type, + 'value' => $reviewer_list, + ), + ); + } + private function flattenReviewers(array $values) { // NOTE: For now, `arc` relies on this field returning only scalars, so we // need to reduce the results into scalars. See T10981. diff --git a/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php b/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php index c440a5d4c8..1c4a2c9d60 100644 --- a/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php +++ b/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php @@ -76,4 +76,8 @@ final class DifferentialRevisionIDCommitMessageField return PhabricatorEnv::getProductionURI('/D'.$value); } + public function getFieldTransactions($value) { + return array(); + } + } diff --git a/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php b/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php index 713dc9d3ed..12d36e4381 100644 --- a/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php +++ b/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php @@ -48,4 +48,13 @@ final class DifferentialSubscribersCommitMessageField return $this->renderHandleList($value); } + public function getFieldTransactions($value) { + return array( + array( + 'type' => PhabricatorSubscriptionsEditEngineExtension::EDITKEY_SET, + 'value' => $value, + ), + ); + } + } diff --git a/src/applications/differential/field/DifferentialSummaryCommitMessageField.php b/src/applications/differential/field/DifferentialSummaryCommitMessageField.php index 2689205fbe..6b57942470 100644 --- a/src/applications/differential/field/DifferentialSummaryCommitMessageField.php +++ b/src/applications/differential/field/DifferentialSummaryCommitMessageField.php @@ -17,4 +17,13 @@ final class DifferentialSummaryCommitMessageField return $revision->getSummary(); } + public function getFieldTransactions($value) { + return array( + array( + 'type' => DifferentialRevisionSummaryTransaction::EDITKEY, + 'value' => $value, + ), + ); + } + } diff --git a/src/applications/differential/field/DifferentialTagsCommitMessageField.php b/src/applications/differential/field/DifferentialTagsCommitMessageField.php index bd03ba639e..fc6267f1ce 100644 --- a/src/applications/differential/field/DifferentialTagsCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTagsCommitMessageField.php @@ -54,5 +54,13 @@ final class DifferentialTagsCommitMessageField return $this->renderHandleList($value); } + public function getFieldTransactions($value) { + return array( + array( + 'type' => PhabricatorProjectsEditEngineExtension::EDITKEY_SET, + 'value' => $value, + ), + ); + } } diff --git a/src/applications/differential/field/DifferentialTasksCommitMessageField.php b/src/applications/differential/field/DifferentialTasksCommitMessageField.php index 7e0224fbbc..69101f5b95 100644 --- a/src/applications/differential/field/DifferentialTasksCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTasksCommitMessageField.php @@ -54,4 +54,8 @@ final class DifferentialTasksCommitMessageField return $this->renderHandleList($value); } + public function getFieldTransactions($value) { + // TODO: Implement this! + return array(); + } } diff --git a/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php b/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php index e915d5932d..a477a9036e 100644 --- a/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php @@ -41,4 +41,13 @@ final class DifferentialTestPlanCommitMessageField return $revision->getTestPlan(); } + public function getFieldTransactions($value) { + return array( + array( + 'type' => DifferentialRevisionTestPlanTransaction::EDITKEY, + 'value' => $value, + ), + ); + } + } diff --git a/src/applications/differential/field/DifferentialTitleCommitMessageField.php b/src/applications/differential/field/DifferentialTitleCommitMessageField.php index cb481900a5..6b39796f3a 100644 --- a/src/applications/differential/field/DifferentialTitleCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTitleCommitMessageField.php @@ -47,4 +47,13 @@ final class DifferentialTitleCommitMessageField return $value; } + public function getFieldTransactions($value) { + return array( + array( + 'type' => DifferentialRevisionTitleTransaction::EDITKEY, + 'value' => $value, + ), + ); + } + } diff --git a/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php b/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php index 6c67f48706..6ecf738162 100644 --- a/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php +++ b/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php @@ -4,6 +4,7 @@ final class DifferentialRevisionReviewersTransaction extends DifferentialRevisionTransactionType { const TRANSACTIONTYPE = 'differential.revision.reviewers'; + const EDITKEY = 'reviewers'; public function generateOldValue($object) { $reviewers = $object->getReviewerStatus(); @@ -18,6 +19,7 @@ final class DifferentialRevisionReviewersTransaction ->setViewer($actor); $reviewers = $this->generateOldValue($object); + $old_reviewers = $reviewers; // First, remove any reviewers we're getting rid of. $rem = idx($value, '-', array()); @@ -63,7 +65,7 @@ final class DifferentialRevisionReviewersTransaction $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; foreach ($add_map as $phid => $new_status) { - $old_status = idx($reviewers, $phid); + $old_status = idx($old_reviewers, $phid); // If we have an old status and this didn't make the reviewer blocking // or nonblocking, just retain the old status. This makes sure we don't @@ -76,6 +78,7 @@ final class DifferentialRevisionReviewersTransaction $is_unblock = (!$now_blocking && $was_blocking); if (!$is_block && !$is_unblock) { + $reviewers[$phid] = $old_status; continue; } } @@ -86,6 +89,14 @@ final class DifferentialRevisionReviewersTransaction return $reviewers; } + public function getTransactionHasEffect($object, $old, $new) { + // At least for now, we ignore transactions which ONLY reorder reviewers + // without making any actual changes. + ksort($old); + ksort($new); + return ($old !== $new); + } + public function applyExternalEffects($object, $value) { $src_phid = $object->getPHID(); diff --git a/src/applications/differential/xaction/DifferentialRevisionSummaryTransaction.php b/src/applications/differential/xaction/DifferentialRevisionSummaryTransaction.php index 0ad6ba0971..a4f1dcafa5 100644 --- a/src/applications/differential/xaction/DifferentialRevisionSummaryTransaction.php +++ b/src/applications/differential/xaction/DifferentialRevisionSummaryTransaction.php @@ -4,6 +4,7 @@ final class DifferentialRevisionSummaryTransaction extends DifferentialRevisionTransactionType { const TRANSACTIONTYPE = 'differential.revision.summary'; + const EDITKEY = 'summary'; public function generateOldValue($object) { return $object->getSummary(); diff --git a/src/applications/differential/xaction/DifferentialRevisionTestPlanTransaction.php b/src/applications/differential/xaction/DifferentialRevisionTestPlanTransaction.php index 20aef744e6..bf2beab3d8 100644 --- a/src/applications/differential/xaction/DifferentialRevisionTestPlanTransaction.php +++ b/src/applications/differential/xaction/DifferentialRevisionTestPlanTransaction.php @@ -4,6 +4,7 @@ final class DifferentialRevisionTestPlanTransaction extends DifferentialRevisionTransactionType { const TRANSACTIONTYPE = 'differential.revision.testplan'; + const EDITKEY = 'testPlan'; public function generateOldValue($object) { return $object->getTestPlan(); diff --git a/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php b/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php index d5f529f47b..9b763c53ca 100644 --- a/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php +++ b/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php @@ -4,6 +4,7 @@ final class DifferentialRevisionTitleTransaction extends DifferentialRevisionTransactionType { const TRANSACTIONTYPE = 'differential.revision.title'; + const EDITKEY = 'title'; public function generateOldValue($object) { return $object->getTitle(); diff --git a/src/applications/project/engineextension/PhabricatorProjectsEditEngineExtension.php b/src/applications/project/engineextension/PhabricatorProjectsEditEngineExtension.php index ce9fbf332c..5daacd315c 100644 --- a/src/applications/project/engineextension/PhabricatorProjectsEditEngineExtension.php +++ b/src/applications/project/engineextension/PhabricatorProjectsEditEngineExtension.php @@ -5,6 +5,10 @@ final class PhabricatorProjectsEditEngineExtension const EXTENSIONKEY = 'projects.projects'; + const EDITKEY_ADD = 'projects.add'; + const EDITKEY_SET = 'projects.set'; + const EDITKEY_REMOVE = 'projects.remove'; + public function getExtensionPriority() { return 500; } @@ -58,14 +62,14 @@ final class PhabricatorProjectsEditEngineExtension $projects_field->setViewer($engine->getViewer()); - $edit_add = $projects_field->getConduitEditType('projects.add') + $edit_add = $projects_field->getConduitEditType(self::EDITKEY_ADD) ->setConduitDescription(pht('Add project tags.')); - $edit_set = $projects_field->getConduitEditType('projects.set') + $edit_set = $projects_field->getConduitEditType(self::EDITKEY_SET) ->setConduitDescription( pht('Set project tags, overwriting current value.')); - $edit_rem = $projects_field->getConduitEditType('projects.remove') + $edit_rem = $projects_field->getConduitEditType(self::EDITKEY_REMOVE) ->setConduitDescription(pht('Remove project tags.')); return array( diff --git a/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsEditEngineExtension.php b/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsEditEngineExtension.php index a0a6cbf7be..ac0d3896cc 100644 --- a/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsEditEngineExtension.php +++ b/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsEditEngineExtension.php @@ -5,6 +5,10 @@ final class PhabricatorSubscriptionsEditEngineExtension const EXTENSIONKEY = 'subscriptions.subscribers'; + const EDITKEY_ADD = 'subscribers.add'; + const EDITKEY_SET = 'subscribers.set'; + const EDITKEY_REMOVE = 'subscribers.remove'; + public function getExtensionPriority() { return 750; } @@ -52,14 +56,14 @@ final class PhabricatorSubscriptionsEditEngineExtension $subscribers_field->setViewer($engine->getViewer()); - $edit_add = $subscribers_field->getConduitEditType('subscribers.add') + $edit_add = $subscribers_field->getConduitEditType(self::EDITKEY_ADD) ->setConduitDescription(pht('Add subscribers.')); - $edit_set = $subscribers_field->getConduitEditType('subscribers.set') + $edit_set = $subscribers_field->getConduitEditType(self::EDITKEY_SET) ->setConduitDescription( pht('Set subscribers, overwriting current value.')); - $edit_rem = $subscribers_field->getConduitEditType('subscribers.remove') + $edit_rem = $subscribers_field->getConduitEditType(self::EDITKEY_REMOVE) ->setConduitDescription(pht('Remove subscribers.')); return array( diff --git a/src/applications/transactions/engineextension/PhabricatorCommentEditEngineExtension.php b/src/applications/transactions/engineextension/PhabricatorCommentEditEngineExtension.php index a0a303bdc7..7eb2aee037 100644 --- a/src/applications/transactions/engineextension/PhabricatorCommentEditEngineExtension.php +++ b/src/applications/transactions/engineextension/PhabricatorCommentEditEngineExtension.php @@ -4,6 +4,7 @@ final class PhabricatorCommentEditEngineExtension extends PhabricatorEditEngineExtension { const EXTENSIONKEY = 'transactions.comment'; + const EDITKEY = 'comment'; public function getExtensionPriority() { return 9000; @@ -39,7 +40,7 @@ final class PhabricatorCommentEditEngineExtension $comment_type = PhabricatorTransactions::TYPE_COMMENT; $comment_field = id(new PhabricatorCommentEditField()) - ->setKey('comment') + ->setKey(self::EDITKEY) ->setLabel(pht('Comments')) ->setAliases(array('comments')) ->setIsHidden(true) diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php b/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php index 2c5556cb4a..6956561490 100644 --- a/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php +++ b/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php @@ -396,13 +396,16 @@ abstract class PhabricatorTypeaheadDatasource extends Phobject { if (!self::isFunctionToken($token)) { $results[] = $token; } else { - $evaluate[] = $token; + // Put a placeholder in the result list so that we retain token order + // when possible. We'll overwrite this below. + $results[] = null; + $evaluate[last_key($results)] = $token; } } $results = $this->evaluateValues($results); - foreach ($evaluate as $function) { + foreach ($evaluate as $result_key => $function) { $function = self::parseFunction($function); if (!$function) { throw new PhabricatorTypeaheadInvalidTokenException(); @@ -411,11 +414,23 @@ abstract class PhabricatorTypeaheadDatasource extends Phobject { $name = $function['name']; $argv = $function['argv']; - foreach ($this->evaluateFunction($name, array($argv)) as $phid) { - $results[] = $phid; + $evaluated_tokens = $this->evaluateFunction($name, array($argv)); + if (!$evaluated_tokens) { + unset($results[$result_key]); + } else { + $is_first = true; + foreach ($evaluated_tokens as $phid) { + if ($is_first) { + $results[$result_key] = $phid; + $is_first = false; + } else { + $results[] = $phid; + } + } } } + $results = array_values($results); $results = $this->didEvaluateTokens($results); return $results; From a74d602b3c33759259af4ac5a900a54d9d09594a Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 06:08:06 -0800 Subject: [PATCH 47/78] Make stored custom fields work with v3 EditEngine API Summary: Ref T11114. This makes the unusual stored custom fields ("Blame Rev", "Revert Plan", etc) work somewhat correctly (?) with EditEngine. Test Plan: - Created, updated and edited revisions with unusual stored custom fields like "Blame Rev". - Observed that these fields now populate in "differential.revision.edit" when available. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17068 --- .../customfield/DifferentialAuditorsField.php | 8 ++++++++ .../customfield/DifferentialBlameRevisionField.php | 8 ++++++++ .../differential/customfield/DifferentialCustomField.php | 5 +++++ .../customfield/DifferentialJIRAIssuesField.php | 9 +++++++-- .../customfield/DifferentialRevertPlanField.php | 8 ++++++++ .../field/DifferentialCommitMessageCustomField.php | 8 ++++++-- .../transactions/edittype/PhabricatorEditType.php | 7 +++++++ 7 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialAuditorsField.php b/src/applications/differential/customfield/DifferentialAuditorsField.php index d84fe0eda8..3929cf07ea 100644 --- a/src/applications/differential/customfield/DifferentialAuditorsField.php +++ b/src/applications/differential/customfield/DifferentialAuditorsField.php @@ -57,4 +57,12 @@ final class DifferentialAuditorsField return $this->renderObjectList($handles); } + public function shouldAppearInConduitTransactions() { + return true; + } + + protected function newConduitEditParameterType() { + return new ConduitPHIDListParameterType(); + } + } diff --git a/src/applications/differential/customfield/DifferentialBlameRevisionField.php b/src/applications/differential/customfield/DifferentialBlameRevisionField.php index ba2220ae30..99915440c8 100644 --- a/src/applications/differential/customfield/DifferentialBlameRevisionField.php +++ b/src/applications/differential/customfield/DifferentialBlameRevisionField.php @@ -114,4 +114,12 @@ final class DifferentialBlameRevisionField return true; } + public function shouldAppearInConduitTransactions() { + return true; + } + + protected function newConduitEditParameterType() { + return new ConduitStringParameterType(); + } + } diff --git a/src/applications/differential/customfield/DifferentialCustomField.php b/src/applications/differential/customfield/DifferentialCustomField.php index d0980736c4..f210dd0f63 100644 --- a/src/applications/differential/customfield/DifferentialCustomField.php +++ b/src/applications/differential/customfield/DifferentialCustomField.php @@ -20,6 +20,11 @@ abstract class DifferentialCustomField return $this->getFieldKey(); } + // TODO: As above. + public function getModernFieldKey() { + return $this->getFieldKeyForConduit(); + } + public function shouldEnableForRole($role) { switch ($role) { case self::ROLE_COMMITMESSAGE: diff --git a/src/applications/differential/customfield/DifferentialJIRAIssuesField.php b/src/applications/differential/customfield/DifferentialJIRAIssuesField.php index e40e34f4ad..fc15f4a45b 100644 --- a/src/applications/differential/customfield/DifferentialJIRAIssuesField.php +++ b/src/applications/differential/customfield/DifferentialJIRAIssuesField.php @@ -295,8 +295,6 @@ final class DifferentialJIRAIssuesField return $this; } - - public function renderCommitMessageValue(array $handles) { $value = $this->getValue(); if (!$value) { @@ -309,5 +307,12 @@ final class DifferentialJIRAIssuesField return true; } + public function shouldAppearInConduitTransactions() { + return true; + } + + protected function newConduitEditParameterType() { + return new ConduitStringListParameterType(); + } } diff --git a/src/applications/differential/customfield/DifferentialRevertPlanField.php b/src/applications/differential/customfield/DifferentialRevertPlanField.php index 646116c74e..0fd5531426 100644 --- a/src/applications/differential/customfield/DifferentialRevertPlanField.php +++ b/src/applications/differential/customfield/DifferentialRevertPlanField.php @@ -142,4 +142,12 @@ final class DifferentialRevertPlanField return true; } + public function shouldAppearInConduitTransactions() { + return true; + } + + protected function newConduitEditParameterType() { + return new ConduitStringParameterType(); + } + } diff --git a/src/applications/differential/field/DifferentialCommitMessageCustomField.php b/src/applications/differential/field/DifferentialCommitMessageCustomField.php index b53b8d3147..cfa71a2a58 100644 --- a/src/applications/differential/field/DifferentialCommitMessageCustomField.php +++ b/src/applications/differential/field/DifferentialCommitMessageCustomField.php @@ -61,8 +61,12 @@ abstract class DifferentialCommitMessageCustomField } public function getFieldTransactions($value) { - // TODO: Implement this! - return array(); + return array( + array( + 'type' => $this->getCommitMessageFieldKey(), + 'value' => $value, + ), + ); } } diff --git a/src/applications/transactions/edittype/PhabricatorEditType.php b/src/applications/transactions/edittype/PhabricatorEditType.php index 298238aeb1..1451ec2c04 100644 --- a/src/applications/transactions/edittype/PhabricatorEditType.php +++ b/src/applications/transactions/edittype/PhabricatorEditType.php @@ -107,6 +107,13 @@ abstract class PhabricatorEditType extends Phobject { public function getConduitType() { $parameter_type = $this->getConduitParameterType(); + if (!$parameter_type) { + throw new Exception( + pht( + 'Edit type (with key "%s") is missing a Conduit parameter type.', + $this->getEditType())); + } + return $parameter_type->getTypeName(); } From d12856b5d428062eb3b6917fffa3334ee3d28cbc Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 06:25:35 -0800 Subject: [PATCH 48/78] Remove "Apply Patch" UI field from Differential Summary: Ref T12026. This simplifies the UI and makes T11114 easier. I plan to integrate this into "Download Raw Diff" in the future. Test Plan: - Browsed revisions. - Grepped for removed class name. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12026 Differential Revision: https://secure.phabricator.com/D17069 --- src/__phutil_library_map__.php | 2 -- .../PhabricatorDifferentialConfigOptions.php | 2 -- .../DifferentialApplyPatchField.php | 32 ------------------- 3 files changed, 36 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialApplyPatchField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index c89c4733c5..27df51bc02 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -351,7 +351,6 @@ phutil_register_library_map(array( 'DifferentialAddCommentView' => 'applications/differential/view/DifferentialAddCommentView.php', 'DifferentialAdjustmentMapTestCase' => 'applications/differential/storage/__tests__/DifferentialAdjustmentMapTestCase.php', 'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php', - 'DifferentialApplyPatchField' => 'applications/differential/customfield/DifferentialApplyPatchField.php', 'DifferentialAsanaRepresentationField' => 'applications/differential/customfield/DifferentialAsanaRepresentationField.php', 'DifferentialAuditorsCommitMessageField' => 'applications/differential/field/DifferentialAuditorsCommitMessageField.php', 'DifferentialAuditorsField' => 'applications/differential/customfield/DifferentialAuditorsField.php', @@ -4996,7 +4995,6 @@ phutil_register_library_map(array( 'DifferentialAddCommentView' => 'AphrontView', 'DifferentialAdjustmentMapTestCase' => 'PhutilTestCase', 'DifferentialAffectedPath' => 'DifferentialDAO', - 'DifferentialApplyPatchField' => 'DifferentialCustomField', 'DifferentialAsanaRepresentationField' => 'DifferentialCustomField', 'DifferentialAuditorsCommitMessageField' => 'DifferentialCommitMessageCustomField', 'DifferentialAuditorsField' => 'DifferentialStoredCustomField', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 3eb1568a76..6083c2a97f 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -58,8 +58,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialUnitField(), new DifferentialRevertPlanField(), - new DifferentialApplyPatchField(), - new DifferentialRevisionIDField(), ); diff --git a/src/applications/differential/customfield/DifferentialApplyPatchField.php b/src/applications/differential/customfield/DifferentialApplyPatchField.php deleted file mode 100644 index 24665b7f5c..0000000000 --- a/src/applications/differential/customfield/DifferentialApplyPatchField.php +++ /dev/null @@ -1,32 +0,0 @@ -getFieldName(); - } - - public function renderPropertyViewValue(array $handles) { - $mono = $this->getObject()->getMonogram(); - - return phutil_tag('tt', array(), "arc patch {$mono}"); - } - -} From 914d9fa8b94f69288de46879060566b29aa31f05 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 06:28:26 -0800 Subject: [PATCH 49/78] Simplify Auditors custom field in Differential Summary: Ref T11114. This field just stores the value of "Auditors" so you can trigger auditors explicitly later on if you want. Test Plan: Created and edited revisions with "Auditors". Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17070 --- .../customfield/DifferentialAuditorsField.php | 31 ++++++------------- ...DifferentialAuditorsCommitMessageField.php | 8 +++++ .../field/DifferentialCommitMessageField.php | 2 +- .../PhabricatorCustomFieldEditField.php | 4 +++ ...bricatorCustomFieldEditEngineExtension.php | 2 +- .../field/PhabricatorCustomField.php | 21 +++++++++++++ 6 files changed, 44 insertions(+), 24 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialAuditorsField.php b/src/applications/differential/customfield/DifferentialAuditorsField.php index 3929cf07ea..544f238458 100644 --- a/src/applications/differential/customfield/DifferentialAuditorsField.php +++ b/src/applications/differential/customfield/DifferentialAuditorsField.php @@ -16,7 +16,7 @@ final class DifferentialAuditorsField } public function getValueForStorage() { - return json_encode($this->getValue()); + return phutil_json_encode($this->getValue()); } public function setValueFromStorage($value) { @@ -28,33 +28,16 @@ final class DifferentialAuditorsField return $this; } - public function shouldAppearInCommitMessage() { - return true; - } - - public function shouldAllowEditInCommitMessage() { - return true; - } - public function canDisableField() { return false; } - public function getRequiredHandlePHIDsForCommitMessage() { - return nonempty($this->getValue(), array()); + public function shouldAppearInEditEngine() { + return true; } - public function parseCommitMessageValue($value) { - return $this->parseObjectList( - $value, - array( - PhabricatorPeopleUserPHIDType::TYPECONST, - PhabricatorProjectProjectPHIDType::TYPECONST, - )); - } - - public function renderCommitMessageValue(array $handles) { - return $this->renderObjectList($handles); + public function shouldAppearInCommitMessage() { + return true; } public function shouldAppearInConduitTransactions() { @@ -65,4 +48,8 @@ final class DifferentialAuditorsField return new ConduitPHIDListParameterType(); } + public function shouldAppearInApplicationTransactions() { + return true; + } + } diff --git a/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php b/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php index 2ff430416d..94f629e557 100644 --- a/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php +++ b/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php @@ -22,6 +22,14 @@ final class DifferentialAuditorsCommitMessageField return 'phabricator:auditors'; } + public function isFieldEditable() { + return true; + } + + public function isTemplateField() { + return false; + } + public function readFieldValueFromConduit($value) { return $this->readStringListFieldValueFromConduit($value); } diff --git a/src/applications/differential/field/DifferentialCommitMessageField.php b/src/applications/differential/field/DifferentialCommitMessageField.php index 6e3a0dbbd9..e8478b6497 100644 --- a/src/applications/differential/field/DifferentialCommitMessageField.php +++ b/src/applications/differential/field/DifferentialCommitMessageField.php @@ -182,7 +182,7 @@ abstract class DifferentialCommitMessageField protected function isCustomFieldEnabled($key) { $field_list = PhabricatorCustomField::getObjectFields( new DifferentialRevision(), - PhabricatorCustomField::ROLE_VIEW); + DifferentialCustomField::ROLE_COMMITMESSAGE); $fields = $field_list->getFields(); return isset($fields[$key]); diff --git a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php index 72b359e7ea..ffdb157d8e 100644 --- a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php +++ b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php @@ -37,6 +37,10 @@ final class PhabricatorCustomFieldEditField } protected function buildControl() { + if ($this->getIsConduitOnly()) { + return null; + } + $field = $this->getCustomField(); $clone = clone $field; diff --git a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php index b9427905b8..3edc898cb7 100644 --- a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php +++ b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php @@ -31,7 +31,7 @@ final class PhabricatorCustomFieldEditEngineExtension $field_list = PhabricatorCustomField::getObjectFields( $object, - PhabricatorCustomField::ROLE_EDIT); + PhabricatorCustomField::ROLE_EDITENGINE); $field_list->setViewer($viewer); diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php index 7791700a14..8f88c1469e 100644 --- a/src/infrastructure/customfield/field/PhabricatorCustomField.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php @@ -33,6 +33,7 @@ abstract class PhabricatorCustomField extends Phobject { const ROLE_GLOBALSEARCH = 'GlobalSearch'; const ROLE_CONDUIT = 'conduit'; const ROLE_HERALD = 'herald'; + const ROLE_EDITENGINE = 'EditEngine'; /* -( Building Applications with Custom Fields )--------------------------- */ @@ -292,6 +293,9 @@ abstract class PhabricatorCustomField extends Phobject { return $this->shouldAppearInTransactionMail(); case self::ROLE_HERALD: return $this->shouldAppearInHerald(); + case self::ROLE_EDITENGINE: + return $this->shouldAppearInEditView() || + $this->shouldAppearInEditEngine(); case self::ROLE_DEFAULT: return true; default: @@ -1120,12 +1124,19 @@ abstract class PhabricatorCustomField extends Phobject { return $this->proxy->newStandardEditField(); } + if (!$this->shouldAppearInEditView()) { + $conduit_only = true; + } else { + $conduit_only = false; + } + return $this->newEditField() ->setKey($this->getFieldKey()) ->setEditTypeKey($this->getModernFieldKey()) ->setLabel($this->getFieldName()) ->setDescription($this->getFieldDescription()) ->setTransactionType($this->getApplicationTransactionType()) + ->setIsConduitOnly($conduit_only) ->setValue($this->getNewValueForApplicationTransactions()); } @@ -1146,6 +1157,16 @@ abstract class PhabricatorCustomField extends Phobject { return false; } + /** + * @task edit + */ + public function shouldAppearInEditEngine() { + if ($this->proxy) { + return $this->proxy->shouldAppearInEditEngine(); + } + return false; + } + /** * @task edit From 74a0caf9ce166465ccf5d62b646d977073cca3c5 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 06:51:01 -0800 Subject: [PATCH 50/78] Remove "Author" CustomField in Differential Summary: Ref T11114. This hasn't done anything since we moved author information to the subheader. Test Plan: Browsed Differential, still saw author information. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17071 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialConfigOptions.php | 1 - .../customfield/DifferentialAuthorField.php | 38 ------------------- 3 files changed, 41 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialAuthorField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 27df51bc02..9807448068 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -354,7 +354,6 @@ phutil_register_library_map(array( 'DifferentialAsanaRepresentationField' => 'applications/differential/customfield/DifferentialAsanaRepresentationField.php', 'DifferentialAuditorsCommitMessageField' => 'applications/differential/field/DifferentialAuditorsCommitMessageField.php', 'DifferentialAuditorsField' => 'applications/differential/customfield/DifferentialAuditorsField.php', - 'DifferentialAuthorField' => 'applications/differential/customfield/DifferentialAuthorField.php', 'DifferentialBlameRevisionCommitMessageField' => 'applications/differential/field/DifferentialBlameRevisionCommitMessageField.php', 'DifferentialBlameRevisionField' => 'applications/differential/customfield/DifferentialBlameRevisionField.php', 'DifferentialBlockHeraldAction' => 'applications/differential/herald/DifferentialBlockHeraldAction.php', @@ -4998,7 +4997,6 @@ phutil_register_library_map(array( 'DifferentialAsanaRepresentationField' => 'DifferentialCustomField', 'DifferentialAuditorsCommitMessageField' => 'DifferentialCommitMessageCustomField', 'DifferentialAuditorsField' => 'DifferentialStoredCustomField', - 'DifferentialAuthorField' => 'DifferentialCustomField', 'DifferentialBlameRevisionCommitMessageField' => 'DifferentialCommitMessageCustomField', 'DifferentialBlameRevisionField' => 'DifferentialStoredCustomField', 'DifferentialBlockHeraldAction' => 'HeraldAction', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 6083c2a97f..4bd2b68849 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -30,7 +30,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialTitleField(), new DifferentialSummaryField(), new DifferentialTestPlanField(), - new DifferentialAuthorField(), new DifferentialReviewersField(), new DifferentialProjectReviewersField(), new DifferentialReviewedByField(), diff --git a/src/applications/differential/customfield/DifferentialAuthorField.php b/src/applications/differential/customfield/DifferentialAuthorField.php deleted file mode 100644 index fbd74dd2ab..0000000000 --- a/src/applications/differential/customfield/DifferentialAuthorField.php +++ /dev/null @@ -1,38 +0,0 @@ -getFieldName(); - } - - public function getRequiredHandlePHIDsForPropertyView() { - return array($this->getObject()->getAuthorPHID()); - } - - public function renderPropertyViewValue(array $handles) { - return $handles[$this->getObject()->getAuthorPHID()]->renderHovercardLink(); - } - -} From 93c0ffd02c82f903f9c8989fcf78e1433d67ea0c Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 06:52:50 -0800 Subject: [PATCH 51/78] Remove "Child Revisions" custom field in Differential Summary: Ref T11114. This was obsoleted by the "Stack" graph and does nothing. Test Plan: Viewed revisions, still saw dependency graphs. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17072 --- src/__phutil_library_map__.php | 2 -- .../PhabricatorDifferentialConfigOptions.php | 1 - .../DifferentialChildRevisionsField.php | 22 ------------------- 3 files changed, 25 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialChildRevisionsField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 9807448068..0defc96858 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -379,7 +379,6 @@ phutil_register_library_map(array( 'DifferentialChangesetTwoUpRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpRenderer.php', 'DifferentialChangesetTwoUpTestRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpTestRenderer.php', 'DifferentialChangesetViewController' => 'applications/differential/controller/DifferentialChangesetViewController.php', - 'DifferentialChildRevisionsField' => 'applications/differential/customfield/DifferentialChildRevisionsField.php', 'DifferentialCloseConduitAPIMethod' => 'applications/differential/conduit/DifferentialCloseConduitAPIMethod.php', 'DifferentialCommentPreviewController' => 'applications/differential/controller/DifferentialCommentPreviewController.php', 'DifferentialCommentSaveController' => 'applications/differential/controller/DifferentialCommentSaveController.php', @@ -5025,7 +5024,6 @@ phutil_register_library_map(array( 'DifferentialChangesetTwoUpRenderer' => 'DifferentialChangesetHTMLRenderer', 'DifferentialChangesetTwoUpTestRenderer' => 'DifferentialChangesetTestRenderer', 'DifferentialChangesetViewController' => 'DifferentialController', - 'DifferentialChildRevisionsField' => 'DifferentialCustomField', 'DifferentialCloseConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialCommentPreviewController' => 'DifferentialController', 'DifferentialCommentSaveController' => 'DifferentialController', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 4bd2b68849..0e7a22e86c 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -40,7 +40,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialEditPolicyField(), new DifferentialParentRevisionsField(), - new DifferentialChildRevisionsField(), new DifferentialManiphestTasksField(), new DifferentialCommitsField(), diff --git a/src/applications/differential/customfield/DifferentialChildRevisionsField.php b/src/applications/differential/customfield/DifferentialChildRevisionsField.php deleted file mode 100644 index 1d9406a448..0000000000 --- a/src/applications/differential/customfield/DifferentialChildRevisionsField.php +++ /dev/null @@ -1,22 +0,0 @@ - Date: Fri, 16 Dec 2016 06:56:18 -0800 Subject: [PATCH 52/78] Remove "DifferentialConflictsField" custom field Summary: Ref T11114. This is a pure paring field and now entirely handled by `DifferentialConflictsCommitMessageField`. Test Plan: Grepped for removed class name. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17073 --- src/__phutil_library_map__.php | 2 - .../DifferentialConflictsField.php | 45 ------------------- 2 files changed, 47 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialConflictsField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 0defc96858..16a49b364b 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -389,7 +389,6 @@ phutil_register_library_map(array( 'DifferentialCommitsField' => 'applications/differential/customfield/DifferentialCommitsField.php', 'DifferentialConduitAPIMethod' => 'applications/differential/conduit/DifferentialConduitAPIMethod.php', 'DifferentialConflictsCommitMessageField' => 'applications/differential/field/DifferentialConflictsCommitMessageField.php', - 'DifferentialConflictsField' => 'applications/differential/customfield/DifferentialConflictsField.php', 'DifferentialController' => 'applications/differential/controller/DifferentialController.php', 'DifferentialCoreCustomField' => 'applications/differential/customfield/DifferentialCoreCustomField.php', 'DifferentialCreateCommentConduitAPIMethod' => 'applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php', @@ -5034,7 +5033,6 @@ phutil_register_library_map(array( 'DifferentialCommitsField' => 'DifferentialCustomField', 'DifferentialConduitAPIMethod' => 'ConduitAPIMethod', 'DifferentialConflictsCommitMessageField' => 'DifferentialCommitMessageField', - 'DifferentialConflictsField' => 'DifferentialCustomField', 'DifferentialController' => 'PhabricatorController', 'DifferentialCoreCustomField' => 'DifferentialCustomField', 'DifferentialCreateCommentConduitAPIMethod' => 'DifferentialConduitAPIMethod', diff --git a/src/applications/differential/customfield/DifferentialConflictsField.php b/src/applications/differential/customfield/DifferentialConflictsField.php deleted file mode 100644 index 590d9fd3a7..0000000000 --- a/src/applications/differential/customfield/DifferentialConflictsField.php +++ /dev/null @@ -1,45 +0,0 @@ - Date: Fri, 16 Dec 2016 06:58:40 -0800 Subject: [PATCH 53/78] Remove "DifferentialEditPolicyField" custom field Summary: Ref T11114. This is now entirely handled by EditEngine and standard policy code. Test Plan: Edited the edit policy of a revision. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17074 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialConfigOptions.php | 1 - .../DifferentialEditPolicyField.php | 50 ------------------- 3 files changed, 53 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialEditPolicyField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 16a49b364b..c2da058d1c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -431,7 +431,6 @@ phutil_register_library_map(array( 'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php', 'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php', 'DifferentialDraft' => 'applications/differential/storage/DifferentialDraft.php', - 'DifferentialEditPolicyField' => 'applications/differential/customfield/DifferentialEditPolicyField.php', 'DifferentialExactUserFunctionDatasource' => 'applications/differential/typeahead/DifferentialExactUserFunctionDatasource.php', 'DifferentialFieldParseException' => 'applications/differential/exception/DifferentialFieldParseException.php', 'DifferentialFieldValidationException' => 'applications/differential/exception/DifferentialFieldValidationException.php', @@ -5082,7 +5081,6 @@ phutil_register_library_map(array( 'DifferentialDiffViewController' => 'DifferentialController', 'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'DoorkeeperFeedStoryPublisher', 'DifferentialDraft' => 'DifferentialDAO', - 'DifferentialEditPolicyField' => 'DifferentialCoreCustomField', 'DifferentialExactUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DifferentialFieldParseException' => 'Exception', 'DifferentialFieldValidationException' => 'Exception', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 0e7a22e86c..d09807e586 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -37,7 +37,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialRepositoryField(), new DifferentialProjectsField(), new DifferentialViewPolicyField(), - new DifferentialEditPolicyField(), new DifferentialParentRevisionsField(), new DifferentialManiphestTasksField(), diff --git a/src/applications/differential/customfield/DifferentialEditPolicyField.php b/src/applications/differential/customfield/DifferentialEditPolicyField.php deleted file mode 100644 index 8175fa2b5b..0000000000 --- a/src/applications/differential/customfield/DifferentialEditPolicyField.php +++ /dev/null @@ -1,50 +0,0 @@ -getEditPolicy(); - } - - public function readValueFromRequest(AphrontRequest $request) { - $this->setValue($request->getStr($this->getFieldKey())); - } - - public function renderEditControl(array $handles) { - $viewer = $this->getViewer(); - $revision = $this->getObject(); - - $policies = id(new PhabricatorPolicyQuery()) - ->setViewer($viewer) - ->setObject($revision) - ->execute(); - - return id(new AphrontFormPolicyControl()) - ->setUser($viewer) - ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) - ->setPolicyObject($revision) - ->setPolicies($policies) - ->setName($this->getFieldKey()) - ->setValue($this->getValue()) - ->setError($this->getFieldError()); - } - - public function getApplicationTransactionType() { - return PhabricatorTransactions::TYPE_EDIT_POLICY; - } - -} From 5ea071f65834861c68cc1ce8f4493e1dfd77b814 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 07:11:19 -0800 Subject: [PATCH 54/78] Remove "DifferentialGitSVNIDField" custom field in Differential Summary: Ref T11114. This is obsolted by the narrower `DifferentialGitSVNIDCommitMessageField`. Test Plan: Browsed around. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17075 --- src/__phutil_library_map__.php | 2 - .../customfield/DifferentialGitSVNIDField.php | 45 ------------------- 2 files changed, 47 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialGitSVNIDField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index c2da058d1c..41826e0343 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -445,7 +445,6 @@ phutil_register_library_map(array( 'DifferentialGetWorkingCopy' => 'applications/differential/DifferentialGetWorkingCopy.php', 'DifferentialGitHubLandingStrategy' => 'applications/differential/landing/DifferentialGitHubLandingStrategy.php', 'DifferentialGitSVNIDCommitMessageField' => 'applications/differential/field/DifferentialGitSVNIDCommitMessageField.php', - 'DifferentialGitSVNIDField' => 'applications/differential/customfield/DifferentialGitSVNIDField.php', 'DifferentialHarbormasterField' => 'applications/differential/customfield/DifferentialHarbormasterField.php', 'DifferentialHiddenComment' => 'applications/differential/storage/DifferentialHiddenComment.php', 'DifferentialHostField' => 'applications/differential/customfield/DifferentialHostField.php', @@ -5095,7 +5094,6 @@ phutil_register_library_map(array( 'DifferentialGetWorkingCopy' => 'Phobject', 'DifferentialGitHubLandingStrategy' => 'DifferentialLandingStrategy', 'DifferentialGitSVNIDCommitMessageField' => 'DifferentialCommitMessageField', - 'DifferentialGitSVNIDField' => 'DifferentialCustomField', 'DifferentialHarbormasterField' => 'DifferentialCustomField', 'DifferentialHiddenComment' => 'DifferentialDAO', 'DifferentialHostField' => 'DifferentialCustomField', diff --git a/src/applications/differential/customfield/DifferentialGitSVNIDField.php b/src/applications/differential/customfield/DifferentialGitSVNIDField.php deleted file mode 100644 index de45c54c7f..0000000000 --- a/src/applications/differential/customfield/DifferentialGitSVNIDField.php +++ /dev/null @@ -1,45 +0,0 @@ - Date: Fri, 16 Dec 2016 07:17:05 -0800 Subject: [PATCH 55/78] Remove "Next Step" Differential custom field Summary: Ref T12027. This is purely a UI hint for new users that I'd like to integrate into "Land Revision" in the future instead. Test Plan: Grepped for removed class, browsed Differential. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12027 Differential Revision: https://secure.phabricator.com/D17076 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialConfigOptions.php | 2 - .../customfield/DifferentialNextStepField.php | 65 ------------------- 3 files changed, 69 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialNextStepField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 41826e0343..bda6b89d07 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -473,7 +473,6 @@ phutil_register_library_map(array( 'DifferentialMailView' => 'applications/differential/mail/DifferentialMailView.php', 'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php', 'DifferentialModernHunk' => 'applications/differential/storage/DifferentialModernHunk.php', - 'DifferentialNextStepField' => 'applications/differential/customfield/DifferentialNextStepField.php', 'DifferentialParentRevisionsField' => 'applications/differential/customfield/DifferentialParentRevisionsField.php', 'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php', 'DifferentialParseCommitMessageConduitAPIMethod' => 'applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php', @@ -5128,7 +5127,6 @@ phutil_register_library_map(array( 'DifferentialMailView' => 'Phobject', 'DifferentialManiphestTasksField' => 'DifferentialCoreCustomField', 'DifferentialModernHunk' => 'DifferentialHunk', - 'DifferentialNextStepField' => 'DifferentialCustomField', 'DifferentialParentRevisionsField' => 'DifferentialCustomField', 'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector', 'DifferentialParseCommitMessageConduitAPIMethod' => 'DifferentialConduitAPIMethod', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index d09807e586..2d21fd6fe7 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -25,8 +25,6 @@ final class PhabricatorDifferentialConfigOptions $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType'; $fields = array( - new DifferentialNextStepField(), - new DifferentialTitleField(), new DifferentialSummaryField(), new DifferentialTestPlanField(), diff --git a/src/applications/differential/customfield/DifferentialNextStepField.php b/src/applications/differential/customfield/DifferentialNextStepField.php deleted file mode 100644 index bf0ed5972d..0000000000 --- a/src/applications/differential/customfield/DifferentialNextStepField.php +++ /dev/null @@ -1,65 +0,0 @@ -getFieldName(); - } - - public function renderPropertyViewValue(array $handles) { - $revision = $this->getObject(); - $diff = $revision->getActiveDiff(); - - $status = $revision->getStatus(); - if ($status != ArcanistDifferentialRevisionStatus::ACCEPTED) { - return null; - } - - $local_vcs = $diff->getSourceControlSystem(); - switch ($local_vcs) { - case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: - $bookmark = $diff->getBookmark(); - if (strlen($bookmark)) { - $next_step = csprintf('arc land %R', $bookmark); - } else { - $next_step = csprintf('arc land'); - } - break; - case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: - $branch = $diff->getBranch(); - if (strlen($branch)) { - $next_step = csprintf('arc land %R', $branch); - } else { - $next_step = csprintf('arc land'); - } - break; - case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: - $next_step = csprintf('arc commit'); - break; - default: - return null; - } - - $next_step = phutil_tag('tt', array(), (string)$next_step); - - return $next_step; - } - -} From 8bba1eba85db086ca50cca2b76944f7c1dce00e0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 07:23:43 -0800 Subject: [PATCH 56/78] Remove "DifferentialParentRevisionsField" custom field Summary: Ref T11114. This was obsoleted by UI changes and hacked around for performance in T11404. It no longer does anything. Test Plan: Grepped for removed class name. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17077 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialConfigOptions.php | 1 - .../DifferentialParentRevisionsField.php | 44 ------------------- 3 files changed, 47 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialParentRevisionsField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index bda6b89d07..540f7a20d7 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -473,7 +473,6 @@ phutil_register_library_map(array( 'DifferentialMailView' => 'applications/differential/mail/DifferentialMailView.php', 'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php', 'DifferentialModernHunk' => 'applications/differential/storage/DifferentialModernHunk.php', - 'DifferentialParentRevisionsField' => 'applications/differential/customfield/DifferentialParentRevisionsField.php', 'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php', 'DifferentialParseCommitMessageConduitAPIMethod' => 'applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php', 'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php', @@ -5127,7 +5126,6 @@ phutil_register_library_map(array( 'DifferentialMailView' => 'Phobject', 'DifferentialManiphestTasksField' => 'DifferentialCoreCustomField', 'DifferentialModernHunk' => 'DifferentialHunk', - 'DifferentialParentRevisionsField' => 'DifferentialCustomField', 'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector', 'DifferentialParseCommitMessageConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialParseRenderTestCase' => 'PhabricatorTestCase', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 2d21fd6fe7..374b572f87 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -36,7 +36,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialProjectsField(), new DifferentialViewPolicyField(), - new DifferentialParentRevisionsField(), new DifferentialManiphestTasksField(), new DifferentialCommitsField(), diff --git a/src/applications/differential/customfield/DifferentialParentRevisionsField.php b/src/applications/differential/customfield/DifferentialParentRevisionsField.php deleted file mode 100644 index 5dbc99dd6f..0000000000 --- a/src/applications/differential/customfield/DifferentialParentRevisionsField.php +++ /dev/null @@ -1,44 +0,0 @@ -getObject()->getPHID(), - DifferentialRevisionDependsOnRevisionEdgeType::EDGECONST); - } - -} From 5e606504b7f5ba38f3abec95c8761f728b2f1f8b Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 07:25:47 -0800 Subject: [PATCH 57/78] Remove "DifferentialProjectsField" custom field Summary: Ref T11114. This is entirely obsoleted by EditEngine. Test Plan: Edited projects on a revision. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17078 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialConfigOptions.php | 1 - .../customfield/DifferentialProjectsField.php | 110 ------------------ 3 files changed, 113 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialProjectsField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 540f7a20d7..4a8e92ffbc 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -478,7 +478,6 @@ phutil_register_library_map(array( 'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php', 'DifferentialPathField' => 'applications/differential/customfield/DifferentialPathField.php', 'DifferentialProjectReviewersField' => 'applications/differential/customfield/DifferentialProjectReviewersField.php', - 'DifferentialProjectsField' => 'applications/differential/customfield/DifferentialProjectsField.php', 'DifferentialQueryConduitAPIMethod' => 'applications/differential/conduit/DifferentialQueryConduitAPIMethod.php', 'DifferentialQueryDiffsConduitAPIMethod' => 'applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php', 'DifferentialRawDiffRenderer' => 'applications/differential/render/DifferentialRawDiffRenderer.php', @@ -5131,7 +5130,6 @@ phutil_register_library_map(array( 'DifferentialParseRenderTestCase' => 'PhabricatorTestCase', 'DifferentialPathField' => 'DifferentialCustomField', 'DifferentialProjectReviewersField' => 'DifferentialCustomField', - 'DifferentialProjectsField' => 'DifferentialCoreCustomField', 'DifferentialQueryConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialQueryDiffsConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialRawDiffRenderer' => 'Phobject', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 374b572f87..9872ac3ef3 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -33,7 +33,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialReviewedByField(), new DifferentialSubscribersField(), new DifferentialRepositoryField(), - new DifferentialProjectsField(), new DifferentialViewPolicyField(), new DifferentialManiphestTasksField(), diff --git a/src/applications/differential/customfield/DifferentialProjectsField.php b/src/applications/differential/customfield/DifferentialProjectsField.php deleted file mode 100644 index dc126ef8dc..0000000000 --- a/src/applications/differential/customfield/DifferentialProjectsField.php +++ /dev/null @@ -1,110 +0,0 @@ -getPHID()) { - return array(); - } - - $projects = PhabricatorEdgeQuery::loadDestinationPHIDs( - $revision->getPHID(), - PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); - $projects = array_reverse($projects); - - return $projects; - } - - public function getNewValueForApplicationTransactions() { - return array('=' => array_fuse($this->getValue())); - } - - public function readValueFromRequest(AphrontRequest $request) { - $this->setValue($request->getArr($this->getFieldKey())); - } - - public function renderEditControl(array $handles) { - return id(new AphrontFormTokenizerControl()) - ->setUser($this->getViewer()) - ->setName($this->getFieldKey()) - ->setDatasource(new PhabricatorProjectDatasource()) - ->setValue($this->getValue()) - ->setLabel($this->getFieldName()); - } - - public function getApplicationTransactionType() { - return PhabricatorTransactions::TYPE_EDGE; - } - - public function shouldAppearInCommitMessage() { - return true; - } - - public function shouldAllowEditInCommitMessage() { - return true; - } - - public function shouldOverwriteWhenCommitMessageIsEdited() { - return true; - } - - public function getCommitMessageLabels() { - return array( - 'Tags', - 'Project', - 'Projects', - ); - } - - public function getRequiredHandlePHIDsForCommitMessage() { - return $this->getValue(); - } - - public function renderCommitMessageValue(array $handles) { - return $this->renderObjectList($handles); - } - - public function shouldAppearInConduitDictionary() { - // To improve performance, we exclude this field from Conduit results. - // See T11404 for discussion. In modern "differential.revision.search", - // this information is available efficiently as an attachment. - return false; - } - - public function getApplicationTransactionMetadata() { - return array( - 'edge:type' => PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, - ); - } - - public function parseValueFromCommitMessage($value) { - return $this->parseObjectList( - $value, - array( - PhabricatorProjectProjectPHIDType::TYPECONST, - )); - } - -} From 77601bf58c9ad7e677e3b062c4afa4336d5a367e Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 07:30:36 -0800 Subject: [PATCH 58/78] Remove "Reviewed By" Differential field Summary: Ref T11114. This is replaced by `DifferentialReviewedByCommitMessageField.php`. Test Plan: - Used `differential.getcommitmessage` to query an accepted revision, saw "Reviewed By". - Grepped for removed class name. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17079 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialConfigOptions.php | 1 - .../DifferentialReviewedByField.php | 68 ------------------- 3 files changed, 71 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialReviewedByField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 4a8e92ffbc..e1e4c9bc92 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -494,7 +494,6 @@ phutil_register_library_map(array( 'DifferentialRevertPlanCommitMessageField' => 'applications/differential/field/DifferentialRevertPlanCommitMessageField.php', 'DifferentialRevertPlanField' => 'applications/differential/customfield/DifferentialRevertPlanField.php', 'DifferentialReviewedByCommitMessageField' => 'applications/differential/field/DifferentialReviewedByCommitMessageField.php', - 'DifferentialReviewedByField' => 'applications/differential/customfield/DifferentialReviewedByField.php', 'DifferentialReviewerDatasource' => 'applications/differential/typeahead/DifferentialReviewerDatasource.php', 'DifferentialReviewerForRevisionEdgeType' => 'applications/differential/edge/DifferentialReviewerForRevisionEdgeType.php', 'DifferentialReviewerProxy' => 'applications/differential/storage/DifferentialReviewerProxy.php', @@ -5146,7 +5145,6 @@ phutil_register_library_map(array( 'DifferentialRevertPlanCommitMessageField' => 'DifferentialCommitMessageCustomField', 'DifferentialRevertPlanField' => 'DifferentialStoredCustomField', 'DifferentialReviewedByCommitMessageField' => 'DifferentialCommitMessageField', - 'DifferentialReviewedByField' => 'DifferentialCoreCustomField', 'DifferentialReviewerDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DifferentialReviewerForRevisionEdgeType' => 'PhabricatorEdgeType', 'DifferentialReviewerProxy' => 'Phobject', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 9872ac3ef3..431982f45e 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -30,7 +30,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialTestPlanField(), new DifferentialReviewersField(), new DifferentialProjectReviewersField(), - new DifferentialReviewedByField(), new DifferentialSubscribersField(), new DifferentialRepositoryField(), new DifferentialViewPolicyField(), diff --git a/src/applications/differential/customfield/DifferentialReviewedByField.php b/src/applications/differential/customfield/DifferentialReviewedByField.php deleted file mode 100644 index b0331f2a6e..0000000000 --- a/src/applications/differential/customfield/DifferentialReviewedByField.php +++ /dev/null @@ -1,68 +0,0 @@ -getReviewerStatus() as $reviewer) { - switch ($reviewer->getStatus()) { - case DifferentialReviewerStatus::STATUS_ACCEPTED: - case DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER: - $phids[] = $reviewer->getReviewerPHID(); - break; - } - } - - return $phids; - } - - public function shouldAppearInCommitMessage() { - return true; - } - - public function parseValueFromCommitMessage($value) { - return $this->parseObjectList( - $value, - array( - PhabricatorPeopleUserPHIDType::TYPECONST, - PhabricatorProjectProjectPHIDType::TYPECONST, - ), - $allow_partial = true); - } - - public function getRequiredHandlePHIDsForCommitMessage() { - return $this->getValue(); - } - - public function renderCommitMessageValue(array $handles) { - return $this->renderObjectList($handles); - } - -} From 3893b5f1a5faaf4efe13912eee7a9365335f59c9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:14:13 -0800 Subject: [PATCH 59/78] Remove "Revision ID" custom field Summary: Ref T11114. Obsoleted by `DifferentialRevisionIDCommitMessageField`. Test Plan: - Grepped for removed class. - Created a new revision, verified that the amended message included a proper revision ID. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17080 --- src/__phutil_library_map__.php | 2 - ...tialParseCommitMessageConduitAPIMethod.php | 4 +- .../PhabricatorDifferentialConfigOptions.php | 2 - .../DifferentialRevisionIDField.php | 85 ------------------- 4 files changed, 1 insertion(+), 92 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialRevisionIDField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index e1e4c9bc92..b976663bf3 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -532,7 +532,6 @@ phutil_register_library_map(array( 'DifferentialRevisionHeraldField' => 'applications/differential/herald/DifferentialRevisionHeraldField.php', 'DifferentialRevisionHeraldFieldGroup' => 'applications/differential/herald/DifferentialRevisionHeraldFieldGroup.php', 'DifferentialRevisionIDCommitMessageField' => 'applications/differential/field/DifferentialRevisionIDCommitMessageField.php', - 'DifferentialRevisionIDField' => 'applications/differential/customfield/DifferentialRevisionIDField.php', 'DifferentialRevisionLandController' => 'applications/differential/controller/DifferentialRevisionLandController.php', 'DifferentialRevisionListController' => 'applications/differential/controller/DifferentialRevisionListController.php', 'DifferentialRevisionListView' => 'applications/differential/view/DifferentialRevisionListView.php', @@ -5199,7 +5198,6 @@ phutil_register_library_map(array( 'DifferentialRevisionHeraldField' => 'HeraldField', 'DifferentialRevisionHeraldFieldGroup' => 'HeraldFieldGroup', 'DifferentialRevisionIDCommitMessageField' => 'DifferentialCommitMessageField', - 'DifferentialRevisionIDField' => 'DifferentialCustomField', 'DifferentialRevisionLandController' => 'DifferentialController', 'DifferentialRevisionListController' => 'DifferentialController', 'DifferentialRevisionListView' => 'AphrontView', diff --git a/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php index 1e82dc935b..59401862f0 100644 --- a/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php @@ -37,11 +37,9 @@ final class DifferentialParseCommitMessageConduitAPIMethod $errors = $parser->getErrors(); - // grab some extra information about the Differential Revision: field... - $revision_id_field = new DifferentialRevisionIDField(); $revision_id_value = idx( $field_map, - $revision_id_field->getFieldKeyForConduit()); + DifferentialRevisionIDCommitMessageField::FIELDKEY); $revision_id_valid_domain = PhabricatorEnv::getProductionURI(''); return array( diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 431982f45e..e6168a4884 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -49,8 +49,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialLintField(), new DifferentialUnitField(), new DifferentialRevertPlanField(), - - new DifferentialRevisionIDField(), ); $default_fields = array(); diff --git a/src/applications/differential/customfield/DifferentialRevisionIDField.php b/src/applications/differential/customfield/DifferentialRevisionIDField.php deleted file mode 100644 index 9d23cf7658..0000000000 --- a/src/applications/differential/customfield/DifferentialRevisionIDField.php +++ /dev/null @@ -1,85 +0,0 @@ -revisionID, $this->getObject()->getID()); - if (!$id) { - return null; - } - return PhabricatorEnv::getProductionURI('/D'.$id); - } - - public function readValueFromCommitMessage($value) { - $this->revisionID = $value; - } - - private static function parseRevisionIDFromURI($uri_string) { - $uri = new PhutilURI($uri_string); - $path = $uri->getPath(); - - $matches = null; - if (preg_match('#^/D(\d+)$#', $path, $matches)) { - $id = (int)$matches[1]; - - $prod_uri = new PhutilURI(PhabricatorEnv::getProductionURI('/D'.$id)); - - // Make sure the URI is the same as our URI. Basically, we want to ignore - // commits from other Phabricator installs. - if ($uri->getDomain() == $prod_uri->getDomain()) { - return $id; - } - - $allowed_uris = PhabricatorEnv::getAllowedURIs('/D'.$id); - - foreach ($allowed_uris as $allowed_uri) { - if ($uri_string == $allowed_uri) { - return $id; - } - } - } - - return null; - } - -} From 84572a3b9351a76568da8768c1c9de506650af4a Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:17:38 -0800 Subject: [PATCH 60/78] Remove Differential subscribers field Summary: Ref T11114. This is obsoleted by `DifferentialSubscribersCommitMessageField` and EditEngine. Test Plan: Edited a revision's subscribers. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17081 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialConfigOptions.php | 1 - .../DifferentialSubscribersField.php | 93 ------------------- 3 files changed, 96 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialSubscribersField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index b976663bf3..a1f8f3582a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -565,7 +565,6 @@ phutil_register_library_map(array( 'DifferentialSetDiffPropertyConduitAPIMethod' => 'applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php', 'DifferentialStoredCustomField' => 'applications/differential/customfield/DifferentialStoredCustomField.php', 'DifferentialSubscribersCommitMessageField' => 'applications/differential/field/DifferentialSubscribersCommitMessageField.php', - 'DifferentialSubscribersField' => 'applications/differential/customfield/DifferentialSubscribersField.php', 'DifferentialSummaryCommitMessageField' => 'applications/differential/field/DifferentialSummaryCommitMessageField.php', 'DifferentialSummaryField' => 'applications/differential/customfield/DifferentialSummaryField.php', 'DifferentialTagsCommitMessageField' => 'applications/differential/field/DifferentialTagsCommitMessageField.php', @@ -5231,7 +5230,6 @@ phutil_register_library_map(array( 'DifferentialSetDiffPropertyConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialStoredCustomField' => 'DifferentialCustomField', 'DifferentialSubscribersCommitMessageField' => 'DifferentialCommitMessageField', - 'DifferentialSubscribersField' => 'DifferentialCoreCustomField', 'DifferentialSummaryCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialSummaryField' => 'DifferentialCoreCustomField', 'DifferentialTagsCommitMessageField' => 'DifferentialCommitMessageField', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index e6168a4884..4b87d38d38 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -30,7 +30,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialTestPlanField(), new DifferentialReviewersField(), new DifferentialProjectReviewersField(), - new DifferentialSubscribersField(), new DifferentialRepositoryField(), new DifferentialViewPolicyField(), diff --git a/src/applications/differential/customfield/DifferentialSubscribersField.php b/src/applications/differential/customfield/DifferentialSubscribersField.php deleted file mode 100644 index b8423e9879..0000000000 --- a/src/applications/differential/customfield/DifferentialSubscribersField.php +++ /dev/null @@ -1,93 +0,0 @@ -getPHID()) { - return array(); - } - - return PhabricatorSubscribersQuery::loadSubscribersForPHID( - $revision->getPHID()); - } - - public function getNewValueForApplicationTransactions() { - return array('=' => $this->getValue()); - } - - public function readValueFromRequest(AphrontRequest $request) { - $this->setValue($request->getArr($this->getFieldKey())); - } - - public function renderEditControl(array $handles) { - return id(new AphrontFormTokenizerControl()) - ->setUser($this->getViewer()) - ->setName($this->getFieldKey()) - ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) - ->setValue($this->getValue()) - ->setError($this->getFieldError()) - ->setLabel($this->getFieldName()); - } - - public function getApplicationTransactionType() { - return PhabricatorTransactions::TYPE_SUBSCRIBERS; - } - - public function shouldAppearInCommitMessage() { - return true; - } - - public function shouldAllowEditInCommitMessage() { - return true; - } - - public function shouldAppearInCommitMessageTemplate() { - return true; - } - - public function getCommitMessageLabels() { - return array( - 'CC', - 'CCs', - 'Subscriber', - 'Subscribers', - ); - } - - public function parseValueFromCommitMessage($value) { - return $this->parseObjectList( - $value, - array( - PhabricatorPeopleUserPHIDType::TYPECONST, - PhabricatorProjectProjectPHIDType::TYPECONST, - PhabricatorOwnersPackagePHIDType::TYPECONST, - )); - } - - public function getRequiredHandlePHIDsForCommitMessage() { - return $this->getValue(); - } - - public function renderCommitMessageValue(array $handles) { - return $this->renderObjectList($handles); - } - -} From f552a20c6193ac9ffc4fca8d2a56d724c33cb813 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:19:55 -0800 Subject: [PATCH 61/78] Remove Differential "View Policy" field Summary: Ref T11114. Obsoleted by EditEngine. Test Plan: Edited the view policy of a revision. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17082 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialConfigOptions.php | 1 - .../DifferentialViewPolicyField.php | 50 ------------------- 3 files changed, 53 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialViewPolicyField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index a1f8f3582a..8abf50a49f 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -582,7 +582,6 @@ phutil_register_library_map(array( 'DifferentialUnitStatus' => 'applications/differential/constants/DifferentialUnitStatus.php', 'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php', 'DifferentialUpdateRevisionConduitAPIMethod' => 'applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php', - 'DifferentialViewPolicyField' => 'applications/differential/customfield/DifferentialViewPolicyField.php', 'DiffusionAuditorDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorDatasource.php', 'DiffusionAuditorFunctionDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorFunctionDatasource.php', 'DiffusionAuditorsAddAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php', @@ -5247,7 +5246,6 @@ phutil_register_library_map(array( 'DifferentialUnitStatus' => 'Phobject', 'DifferentialUnitTestResult' => 'Phobject', 'DifferentialUpdateRevisionConduitAPIMethod' => 'DifferentialConduitAPIMethod', - 'DifferentialViewPolicyField' => 'DifferentialCoreCustomField', 'DiffusionAuditorDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DiffusionAuditorFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DiffusionAuditorsAddAuditorsHeraldAction' => 'DiffusionAuditorsHeraldAction', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 4b87d38d38..8f61f235b0 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -31,7 +31,6 @@ final class PhabricatorDifferentialConfigOptions new DifferentialReviewersField(), new DifferentialProjectReviewersField(), new DifferentialRepositoryField(), - new DifferentialViewPolicyField(), new DifferentialManiphestTasksField(), new DifferentialCommitsField(), diff --git a/src/applications/differential/customfield/DifferentialViewPolicyField.php b/src/applications/differential/customfield/DifferentialViewPolicyField.php deleted file mode 100644 index 9b17413fcf..0000000000 --- a/src/applications/differential/customfield/DifferentialViewPolicyField.php +++ /dev/null @@ -1,50 +0,0 @@ -getViewPolicy(); - } - - public function readValueFromRequest(AphrontRequest $request) { - $this->setValue($request->getStr($this->getFieldKey())); - } - - public function renderEditControl(array $handles) { - $viewer = $this->getViewer(); - $revision = $this->getObject(); - - $policies = id(new PhabricatorPolicyQuery()) - ->setViewer($viewer) - ->setObject($revision) - ->execute(); - - return id(new AphrontFormPolicyControl()) - ->setUser($viewer) - ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) - ->setPolicyObject($revision) - ->setPolicies($policies) - ->setName($this->getFieldKey()) - ->setValue($this->getValue()) - ->setError($this->getFieldError()); - } - - public function getApplicationTransactionType() { - return PhabricatorTransactions::TYPE_VIEW_POLICY; - } - -} From 9e4c16c4c3ac3155665b2dbbc81f593576d61d57 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:23:07 -0800 Subject: [PATCH 62/78] Remove Differential "Title" custom field Summary: Ref T11114. Obsoleted by Modular Transactions + EditEngine + CommitMessageField + we just "hard code" the title of revisions into the page because we're craaazy. Test Plan: - Made an edit on `stable`. - Viewed the edit on this change, it still had the proper UI strings. - Edited/created/updated revisions. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17083 --- src/__phutil_library_map__.php | 2 - .../PhabricatorDifferentialConfigOptions.php | 1 - .../customfield/DifferentialTitleField.php | 125 ------------------ .../storage/DifferentialTransaction.php | 17 +++ .../storage/PhabricatorModularTransaction.php | 6 +- 5 files changed, 22 insertions(+), 129 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialTitleField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 8abf50a49f..31fe6f0817 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -572,7 +572,6 @@ phutil_register_library_map(array( 'DifferentialTestPlanCommitMessageField' => 'applications/differential/field/DifferentialTestPlanCommitMessageField.php', 'DifferentialTestPlanField' => 'applications/differential/customfield/DifferentialTestPlanField.php', 'DifferentialTitleCommitMessageField' => 'applications/differential/field/DifferentialTitleCommitMessageField.php', - 'DifferentialTitleField' => 'applications/differential/customfield/DifferentialTitleField.php', 'DifferentialTransaction' => 'applications/differential/storage/DifferentialTransaction.php', 'DifferentialTransactionComment' => 'applications/differential/storage/DifferentialTransactionComment.php', 'DifferentialTransactionEditor' => 'applications/differential/editor/DifferentialTransactionEditor.php', @@ -5236,7 +5235,6 @@ phutil_register_library_map(array( 'DifferentialTestPlanCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialTestPlanField' => 'DifferentialCoreCustomField', 'DifferentialTitleCommitMessageField' => 'DifferentialCommitMessageField', - 'DifferentialTitleField' => 'DifferentialCoreCustomField', 'DifferentialTransaction' => 'PhabricatorModularTransaction', 'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment', 'DifferentialTransactionEditor' => 'PhabricatorApplicationTransactionEditor', diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 8f61f235b0..a3db26bef6 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -25,7 +25,6 @@ final class PhabricatorDifferentialConfigOptions $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType'; $fields = array( - new DifferentialTitleField(), new DifferentialSummaryField(), new DifferentialTestPlanField(), new DifferentialReviewersField(), diff --git a/src/applications/differential/customfield/DifferentialTitleField.php b/src/applications/differential/customfield/DifferentialTitleField.php deleted file mode 100644 index 82d6ddc1f3..0000000000 --- a/src/applications/differential/customfield/DifferentialTitleField.php +++ /dev/null @@ -1,125 +0,0 @@ ->'); - } - - protected function readValueFromRevision( - DifferentialRevision $revision) { - return $revision->getTitle(); - } - - protected function writeValueToRevision( - DifferentialRevision $revision, - $value) { - $revision->setTitle($value); - } - - protected function getCoreFieldRequiredErrorString() { - return pht('You must choose a title for this revision.'); - } - - public function readValueFromRequest(AphrontRequest $request) { - $this->setValue($request->getStr($this->getFieldKey())); - } - - protected function isCoreFieldRequired() { - return true; - } - - public function renderEditControl(array $handles) { - return id(new AphrontFormTextAreaControl()) - ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT) - ->setName($this->getFieldKey()) - ->setValue($this->getValue()) - ->setError($this->getFieldError()) - ->setLabel($this->getFieldName()); - } - - public function getApplicationTransactionTitle( - PhabricatorApplicationTransaction $xaction) { - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - if (strlen($old)) { - return pht( - '%s retitled this revision from "%s" to "%s".', - $xaction->renderHandleLink($author_phid), - $old, - $new); - } else { - return pht( - '%s created this revision.', - $xaction->renderHandleLink($author_phid)); - } - } - - public function getApplicationTransactionTitleForFeed( - PhabricatorApplicationTransaction $xaction) { - - $object_phid = $xaction->getObjectPHID(); - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - if (strlen($old)) { - return pht( - '%s retitled %s, from "%s" to "%s".', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid), - $old, - $new); - } else { - return pht( - '%s created %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid)); - } - } - - public function shouldAppearInCommitMessage() { - return true; - } - - public function shouldOverwriteWhenCommitMessageIsEdited() { - return true; - } - - public function validateCommitMessageValue($value) { - if (!strlen($value)) { - throw new DifferentialFieldValidationException( - pht( - 'You must provide a revision title in the first line '. - 'of your commit message.')); - } - - if (preg_match('/^<<.*>>$/', $value)) { - throw new DifferentialFieldValidationException( - pht( - 'Replace the line "%s" with a human-readable revision title which '. - 'describes the changes you are making.', - self::getDefaultTitle())); - } - } - -} diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 0c9e0589eb..0ea2731354 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -22,6 +22,23 @@ final class DifferentialTransaction return 'DifferentialRevisionTransactionType'; } + protected function newFallbackModularTransactionType() { + // TODO: This allows us to render modern strings for older transactions + // without doing a migration. At some point, we should do a migration and + // throw this away. + + $xaction_type = $this->getTransactionType(); + if ($xaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) { + switch ($this->getMetadataValue('customfield:key')) { + case 'differential:title': + return new DifferentialRevisionTitleTransaction(); + } + } + + return parent::newFallbackModularTransactionType(); + } + + public function setIsCommandeerSideEffect($is_side_effect) { $this->isCommandeerSideEffect = $is_side_effect; return $this; diff --git a/src/applications/transactions/storage/PhabricatorModularTransaction.php b/src/applications/transactions/storage/PhabricatorModularTransaction.php index a1da48df33..035a2585fd 100644 --- a/src/applications/transactions/storage/PhabricatorModularTransaction.php +++ b/src/applications/transactions/storage/PhabricatorModularTransaction.php @@ -46,7 +46,7 @@ abstract class PhabricatorModularTransaction $key = $this->getTransactionType(); if (empty($types[$key])) { - $type = new PhabricatorCoreVoidTransaction(); + $type = $this->newFallbackModularTransactionType(); } else { $type = clone $types[$key]; } @@ -56,6 +56,10 @@ abstract class PhabricatorModularTransaction return $type; } + protected function newFallbackModularTransactionType() { + return new PhabricatorCoreVoidTransaction(); + } + final public function generateOldValue($object) { return $this->getTransactionImplementation()->generateOldValue($object); } From c458f09dccb34287a517fb4c5799817863594e20 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:38:58 -0800 Subject: [PATCH 63/78] Simplify "Test Plan" custom field Summary: Ref T11114. This leaves mail integration and UI integration, but strips all the editing (now handled by EditEngine) and commit message stuff (now handled by CommitMessageField). Test Plan: Viewed and edited test plans and test plan transactions. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17084 --- .../customfield/DifferentialTestPlanField.php | 110 ------------------ .../storage/DifferentialTransaction.php | 2 + 2 files changed, 2 insertions(+), 110 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialTestPlanField.php b/src/applications/differential/customfield/DifferentialTestPlanField.php index 6a1029dba4..c774e81a08 100644 --- a/src/applications/differential/customfield/DifferentialTestPlanField.php +++ b/src/applications/differential/customfield/DifferentialTestPlanField.php @@ -7,10 +7,6 @@ final class DifferentialTestPlanField return 'differential:test-plan'; } - public function getFieldKeyForConduit() { - return 'testPlan'; - } - public function getFieldName() { return pht('Test Plan'); } @@ -27,83 +23,10 @@ final class DifferentialTestPlanField return $revision->getTestPlan(); } - protected function writeValueToRevision( - DifferentialRevision $revision, - $value) { - $revision->setTestPlan($value); - } - - protected function isCoreFieldRequired() { - return PhabricatorEnv::getEnvConfig('differential.require-test-plan-field'); - } - public function canDisableField() { return true; } - protected function getCoreFieldRequiredErrorString() { - return pht( - 'You must provide a test plan. Describe the actions you performed '. - 'to verify the behavior of this change.'); - } - - public function readValueFromRequest(AphrontRequest $request) { - $this->setValue($request->getStr($this->getFieldKey())); - } - - public function renderEditControl(array $handles) { - return id(new PhabricatorRemarkupControl()) - ->setUser($this->getViewer()) - ->setName($this->getFieldKey()) - ->setValue($this->getValue()) - ->setError($this->getFieldError()) - ->setLabel($this->getFieldName()); - } - - public function getApplicationTransactionTitle( - PhabricatorApplicationTransaction $xaction) { - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - return pht( - '%s updated the test plan for this revision.', - $xaction->renderHandleLink($author_phid)); - } - - public function getApplicationTransactionTitleForFeed( - PhabricatorApplicationTransaction $xaction) { - - $object_phid = $xaction->getObjectPHID(); - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - return pht( - '%s updated the test plan for %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid)); - } - - public function getApplicationTransactionHasChangeDetails( - PhabricatorApplicationTransaction $xaction) { - return true; - } - - public function getApplicationTransactionChangeDetails( - PhabricatorApplicationTransaction $xaction, - PhabricatorUser $viewer) { - return $xaction->renderTextCorpusChangeDetails( - $viewer, - $xaction->getOldValue(), - $xaction->getNewValue()); - } - - public function shouldHideInApplicationTransactions( - PhabricatorApplicationTransaction $xaction) { - return ($xaction->getOldValue() === null); - } - public function shouldAppearInGlobalSearch() { return true; } @@ -139,39 +62,6 @@ final class DifferentialTestPlanField return new PHUIRemarkupView($this->getViewer(), $this->getValue()); } - public function getApplicationTransactionRemarkupBlocks( - PhabricatorApplicationTransaction $xaction) { - return array($xaction->getNewValue()); - } - - public function shouldAppearInCommitMessage() { - return true; - } - - public function shouldAppearInCommitMessageTemplate() { - return true; - } - - public function shouldOverwriteWhenCommitMessageIsEdited() { - return true; - } - - public function getCommitMessageLabels() { - return array( - 'Test Plan', - 'Testplan', - 'Tested', - 'Tests', - ); - } - - public function validateCommitMessageValue($value) { - if (!strlen($value) && $this->isCoreFieldRequired()) { - throw new DifferentialFieldValidationException( - $this->getCoreFieldRequiredErrorString()); - } - } - public function shouldAppearInTransactionMail() { return true; } diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 0ea2731354..fdf4121e1f 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -32,6 +32,8 @@ final class DifferentialTransaction switch ($this->getMetadataValue('customfield:key')) { case 'differential:title': return new DifferentialRevisionTitleTransaction(); + case 'differential:test-plan': + return new DifferentialRevisionTestPlanTransaction(); } } From 2ebbac86ded9ffe25d67138e81dfd6f23d2e5023 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:41:43 -0800 Subject: [PATCH 64/78] Simplify Differential "Summary" field Summary: Ref T11114. Keep UI stuff and mail stuff, toss editing. Test Plan: Viewed and edited revision summaries. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17085 --- .../customfield/DifferentialSummaryField.php | 84 ------------------- 1 file changed, 84 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialSummaryField.php b/src/applications/differential/customfield/DifferentialSummaryField.php index 5052e238e0..a11bebca6e 100644 --- a/src/applications/differential/customfield/DifferentialSummaryField.php +++ b/src/applications/differential/customfield/DifferentialSummaryField.php @@ -7,10 +7,6 @@ final class DifferentialSummaryField return 'differential:summary'; } - public function getFieldKeyForConduit() { - return 'summary'; - } - public function getFieldName() { return pht('Summary'); } @@ -27,69 +23,6 @@ final class DifferentialSummaryField return $revision->getSummary(); } - protected function writeValueToRevision( - DifferentialRevision $revision, - $value) { - $revision->setSummary($value); - } - - public function readValueFromRequest(AphrontRequest $request) { - $this->setValue($request->getStr($this->getFieldKey())); - } - - public function renderEditControl(array $handles) { - return id(new PhabricatorRemarkupControl()) - ->setUser($this->getViewer()) - ->setName($this->getFieldKey()) - ->setValue($this->getValue()) - ->setError($this->getFieldError()) - ->setLabel($this->getFieldName()); - } - - public function getApplicationTransactionTitle( - PhabricatorApplicationTransaction $xaction) { - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - return pht( - '%s updated the summary for this revision.', - $xaction->renderHandleLink($author_phid)); - } - - public function getApplicationTransactionTitleForFeed( - PhabricatorApplicationTransaction $xaction) { - - $object_phid = $xaction->getObjectPHID(); - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - return pht( - '%s updated the summary for %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid)); - } - - public function getApplicationTransactionHasChangeDetails( - PhabricatorApplicationTransaction $xaction) { - return true; - } - - public function getApplicationTransactionChangeDetails( - PhabricatorApplicationTransaction $xaction, - PhabricatorUser $viewer) { - return $xaction->renderTextCorpusChangeDetails( - $viewer, - $xaction->getOldValue(), - $xaction->getNewValue()); - } - - public function shouldHideInApplicationTransactions( - PhabricatorApplicationTransaction $xaction) { - return ($xaction->getOldValue() === null); - } - public function shouldAppearInGlobalSearch() { return true; } @@ -125,23 +58,6 @@ final class DifferentialSummaryField return new PHUIRemarkupView($this->getViewer(), $this->getValue()); } - public function getApplicationTransactionRemarkupBlocks( - PhabricatorApplicationTransaction $xaction) { - return array($xaction->getNewValue()); - } - - public function shouldAppearInCommitMessage() { - return true; - } - - public function shouldAppearInCommitMessageTemplate() { - return true; - } - - public function shouldOverwriteWhenCommitMessageIsEdited() { - return true; - } - public function shouldAppearInTransactionMail() { return true; } From 18debbfdb4f4d766625c335bbe156ba25a9e310c Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:48:40 -0800 Subject: [PATCH 65/78] Simplify Differential "Reviewers" field Summary: Ref T11114. Keep rendering and mail, toss the rest. Test Plan: Edited and viewed reviewers. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17086 --- .../DifferentialReviewersField.php | 239 ------------------ .../storage/DifferentialTransaction.php | 3 + .../PhabricatorApplicationTransaction.php | 15 +- 3 files changed, 15 insertions(+), 242 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialReviewersField.php b/src/applications/differential/customfield/DifferentialReviewersField.php index 5138733c41..ad96a22b88 100644 --- a/src/applications/differential/customfield/DifferentialReviewersField.php +++ b/src/applications/differential/customfield/DifferentialReviewersField.php @@ -7,10 +7,6 @@ final class DifferentialReviewersField return 'differential:reviewers'; } - public function getFieldKeyForConduit() { - return 'reviewerPHIDs'; - } - public function getFieldName() { return pht('Reviewers'); } @@ -24,108 +20,6 @@ final class DifferentialReviewersField return $revision->getReviewerStatus(); } - public function getNewValueForApplicationTransactions() { - $specs = array(); - foreach ($this->getValue() as $reviewer) { - $specs[$reviewer->getReviewerPHID()] = array( - 'data' => $reviewer->getEdgeData(), - ); - } - - return array('=' => $specs); - } - - public function readValueFromRequest(AphrontRequest $request) { - $datasource = id(new DifferentialBlockingReviewerDatasource()) - ->setViewer($request->getViewer()); - - $new_phids = $request->getArr($this->getFieldKey()); - $new_phids = $datasource->evaluateTokens($new_phids); - - $reviewers = array(); - foreach ($new_phids as $spec) { - if (!is_array($spec)) { - $reviewers[$spec] = DifferentialReviewerStatus::STATUS_ADDED; - } else { - $reviewers[$spec['phid']] = $spec['type']; - } - } - - $this->updateReviewers($this->getValue(), $reviewers); - } - - private function updateReviewers(array $old_reviewers, array $new_map) { - // Compute a new set of reviewer objects. We're going to respect the new - // reviewer order, add or remove any new or missing reviewers, and respect - // any blocking or unblocking changes. For reviewers who were there before - // and are still there, we're going to keep the old value because it - // may be something like "Accept", "Reject", etc. - - $old_map = mpull($old_reviewers, 'getStatus', 'getReviewerPHID'); - $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; - - $new_reviewers = array(); - foreach ($new_map as $phid => $new) { - $old = idx($old_map, $phid); - - // If we have an old status and this didn't make the reviewer blocking - // or nonblocking, just retain the old status. This makes sure we don't - // throw away rejects, accepts, etc. - if ($old) { - $is_block = ($old !== $status_blocking && $new === $status_blocking); - $is_unblock = ($old === $status_blocking && $new !== $status_blocking); - if (!$is_block && !$is_unblock) { - $new_reviewers[$phid] = $old; - continue; - } - } - - $new_reviewers[$phid] = $new; - } - - foreach ($new_reviewers as $phid => $status) { - $new_reviewers[$phid] = new DifferentialReviewerProxy( - $phid, - array( - 'status' => $status, - )); - } - - $this->setValue($new_reviewers); - } - - public function renderEditControl(array $handles) { - $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; - - $value = array(); - foreach ($this->getValue() as $reviewer) { - $phid = $reviewer->getReviewerPHID(); - if ($reviewer->getStatus() == $status_blocking) { - $value[] = 'blocking('.$phid.')'; - } else { - $value[] = $phid; - } - } - - return id(new AphrontFormTokenizerControl()) - ->setUser($this->getViewer()) - ->setName($this->getFieldKey()) - ->setDatasource(new DifferentialReviewerDatasource()) - ->setValue($value) - ->setError($this->getFieldError()) - ->setLabel($this->getFieldName()); - } - - public function getApplicationTransactionType() { - return PhabricatorTransactions::TYPE_EDGE; - } - - public function getApplicationTransactionMetadata() { - return array( - 'edge:type' => DifferentialRevisionHasReviewerEdgeType::EDGECONST, - ); - } - public function shouldAppearInPropertyView() { return true; } @@ -164,99 +58,6 @@ final class DifferentialReviewersField return $reviewers; } - public function shouldAppearInCommitMessage() { - return true; - } - - public function shouldAppearInCommitMessageTemplate() { - return true; - } - - public function getCommitMessageLabels() { - return array( - 'Reviewer', - 'Reviewers', - ); - } - - public function parseValueFromCommitMessage($value) { - $results = $this->parseObjectList( - $value, - array( - PhabricatorPeopleUserPHIDType::TYPECONST, - PhabricatorProjectProjectPHIDType::TYPECONST, - PhabricatorOwnersPackagePHIDType::TYPECONST, - ), - false, - array('!')); - - return $this->flattenReviewers($results); - } - - public function getRequiredHandlePHIDsForCommitMessage() { - return mpull($this->getValue(), 'getReviewerPHID'); - } - - public function readValueFromCommitMessage($value) { - $value = $this->inflateReviewers($value); - - $reviewers = array(); - foreach ($value as $spec) { - $phid = $spec['phid']; - - $is_blocking = isset($spec['suffixes']['!']); - if ($is_blocking) { - $status = DifferentialReviewerStatus::STATUS_BLOCKING; - } else { - $status = DifferentialReviewerStatus::STATUS_ADDED; - } - - $reviewers[$phid] = $status; - } - - $this->updateReviewers( - $this->getObject()->getReviewerStatus(), - $reviewers); - - return $this; - } - - public function renderCommitMessageValue(array $handles) { - $suffixes = array(); - - $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; - - foreach ($this->getValue() as $reviewer) { - if ($reviewer->getStatus() == $status_blocking) { - $phid = $reviewer->getReviewerPHID(); - $suffixes[$phid] = '!'; - } - } - - return $this->renderObjectList($handles, $suffixes); - } - - public function validateCommitMessageValue($value) { - if (!$value) { - return; - } - - $author_phid = $this->getObject()->getAuthorPHID(); - - $config_self_accept_key = 'differential.allow-self-accept'; - $allow_self_accept = PhabricatorEnv::getEnvConfig($config_self_accept_key); - - $value = $this->inflateReviewers($value); - foreach ($value as $spec) { - $phid = $spec['phid']; - - if (($phid == $author_phid) && !$allow_self_accept) { - throw new DifferentialFieldValidationException( - pht('The author of a revision can not be a reviewer.')); - } - } - } - public function getRequiredHandlePHIDsForRevisionHeaderWarnings() { return mpull($this->getValue(), 'getReviewerPHID'); } @@ -288,44 +89,4 @@ final class DifferentialReviewersField return $warnings; } - public function getProTips() { - return array( - pht( - 'You can mark a reviewer as blocking by adding an exclamation '. - 'mark ("!") after their name.'), - ); - } - - private function flattenReviewers(array $values) { - // NOTE: For now, `arc` relies on this field returning only scalars, so we - // need to reduce the results into scalars. See T10981. - $result = array(); - - foreach ($values as $value) { - $result[] = $value['phid'].implode('', array_keys($value['suffixes'])); - } - - return $result; - } - - private function inflateReviewers(array $values) { - $result = array(); - - foreach ($values as $value) { - if (substr($value, -1) == '!') { - $value = substr($value, 0, -1); - $suffixes = array('!' => '!'); - } else { - $suffixes = array(); - } - - $result[] = array( - 'phid' => $value, - 'suffixes' => $suffixes, - ); - } - - return $result; - } - } diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index fdf4121e1f..0bdb0d2151 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -27,6 +27,9 @@ final class DifferentialTransaction // without doing a migration. At some point, we should do a migration and // throw this away. + // NOTE: Old reviewer edits are raw edge transactions. They could be + // migrated to modular transactions when the rest of this migrates. + $xaction_type = $this->getTransactionType(); if ($xaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) { switch ($this->getMetadataValue('customfield:key')) { diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index cc583d34c2..8157166bb4 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -960,9 +960,18 @@ abstract class PhabricatorApplicationTransaction if ($field) { return $field->getApplicationTransactionTitle($this); } else { - return pht( - '%s edited a custom field.', - $this->renderHandleLink($author_phid)); + $developer_mode = 'phabricator.developer-mode'; + $is_developer = PhabricatorEnv::getEnvConfig($developer_mode); + if ($is_developer) { + return pht( + '%s edited a custom field (with key "%s").', + $this->renderHandleLink($author_phid), + $this->getMetadata('customfield:key')); + } else { + return pht( + '%s edited a custom field.', + $this->renderHandleLink($author_phid)); + } } case PhabricatorTransactions::TYPE_TOKEN: From f1f24e036034c8edba858d6b2150aef3aa7129dd Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:50:54 -0800 Subject: [PATCH 66/78] Simplify "Repository" field in Differential Summary: Ref T11114. Keep mail and UI, toss the rest. Test Plan: Edited/viewed repositories. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17087 --- .../DifferentialRepositoryField.php | 101 ------------------ .../storage/DifferentialTransaction.php | 2 + 2 files changed, 2 insertions(+), 101 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialRepositoryField.php b/src/applications/differential/customfield/DifferentialRepositoryField.php index 7f39d25823..1d403d160a 100644 --- a/src/applications/differential/customfield/DifferentialRepositoryField.php +++ b/src/applications/differential/customfield/DifferentialRepositoryField.php @@ -20,107 +20,6 @@ final class DifferentialRepositoryField return $revision->getRepositoryPHID(); } - protected function writeValueToRevision( - DifferentialRevision $revision, - $value) { - $revision->setRepositoryPHID($value); - } - - public function readValueFromRequest(AphrontRequest $request) { - $phids = $request->getArr($this->getFieldKey()); - $first = head($phids); - $this->setValue(nonempty($first, null)); - } - - public function renderEditControl(array $handles) { - if ($this->getValue()) { - $value = array($this->getValue()); - } else { - $value = array(); - } - - return id(new AphrontFormTokenizerControl()) - ->setUser($this->getViewer()) - ->setName($this->getFieldKey()) - ->setDatasource(new DiffusionRepositoryDatasource()) - ->setValue($value) - ->setError($this->getFieldError()) - ->setLabel($this->getFieldName()) - ->setLimit(1); - } - - public function getApplicationTransactionRequiredHandlePHIDs( - PhabricatorApplicationTransaction $xaction) { - - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - $phids = array(); - if ($old) { - $phids[] = $old; - } - if ($new) { - $phids[] = $new; - } - - return $phids; - } - - public function getApplicationTransactionTitle( - PhabricatorApplicationTransaction $xaction) { - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - if ($old && $new) { - return pht( - '%s changed the repository for this revision from %s to %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($old), - $xaction->renderHandleLink($new)); - } else if ($new) { - return pht( - '%s set the repository for this revision to %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($new)); - } else { - return pht( - '%s removed %s as the repository for this revision.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($old)); - } - } - - public function getApplicationTransactionTitleForFeed( - PhabricatorApplicationTransaction $xaction) { - - $object_phid = $xaction->getObjectPHID(); - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - if ($old && $new) { - return pht( - '%s updated the repository for %s from %s to %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid), - $xaction->renderHandleLink($old), - $xaction->renderHandleLink($new)); - } else if ($new) { - return pht( - '%s set the repository for %s to %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid), - $xaction->renderHandleLink($new)); - } else { - return pht( - '%s removed the repository for %s. (Repository was %s.)', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid), - $xaction->renderHandleLink($old)); - } - } - public function shouldAppearInPropertyView() { return true; } diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 0bdb0d2151..08c66c7fa5 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -37,6 +37,8 @@ final class DifferentialTransaction return new DifferentialRevisionTitleTransaction(); case 'differential:test-plan': return new DifferentialRevisionTestPlanTransaction(); + case 'differential:repository': + return new DifferentialRevisionRepositoryTransaction(); } } From 60f41b87e9d0d3d91e988c8d3d1079605ab27ac2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:57:10 -0800 Subject: [PATCH 67/78] Simplify "Tasks" field in Differential Summary: Ref T11114. Keep UI, throw everything else away. Includes an imperfect-but-not-too-awful fix to keep the field actually working. Test Plan: Edited tasks from CLI. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17088 --- .../DifferentialManiphestTasksField.php | 63 ------------------- .../DifferentialProjectReviewersField.php | 9 --- .../editor/DifferentialRevisionEditEngine.php | 15 +++++ .../field/DifferentialCommitMessageField.php | 2 +- .../DifferentialTasksCommitMessageField.php | 8 ++- 5 files changed, 22 insertions(+), 75 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialManiphestTasksField.php b/src/applications/differential/customfield/DifferentialManiphestTasksField.php index 1724338d97..8e70f1da4d 100644 --- a/src/applications/differential/customfield/DifferentialManiphestTasksField.php +++ b/src/applications/differential/customfield/DifferentialManiphestTasksField.php @@ -7,10 +7,6 @@ final class DifferentialManiphestTasksField return 'differential:maniphest-tasks'; } - public function getFieldKeyForConduit() { - return 'maniphestTaskPHIDs'; - } - public function canDisableField() { return false; } @@ -41,25 +37,6 @@ final class DifferentialManiphestTasksField DifferentialRevisionHasTaskEdgeType::EDGECONST); } - public function getApplicationTransactionType() { - return PhabricatorTransactions::TYPE_EDGE; - } - - public function getApplicationTransactionMetadata() { - return array( - 'edge:type' => DifferentialRevisionHasTaskEdgeType::EDGECONST, - ); - } - - public function getNewValueForApplicationTransactions() { - $edges = array(); - foreach ($this->getValue() as $phid) { - $edges[$phid] = $phid; - } - - return array('=' => $edges); - } - public function getRequiredHandlePHIDsForPropertyView() { return $this->getValue(); } @@ -68,44 +45,4 @@ final class DifferentialManiphestTasksField return $this->renderHandleList($handles); } - public function shouldAppearInCommitMessage() { - return true; - } - - public function shouldAllowEditInCommitMessage() { - return true; - } - - public function getCommitMessageLabels() { - return array( - 'Maniphest Task', - 'Maniphest Tasks', - ); - } - - public function parseValueFromCommitMessage($value) { - return $this->parseObjectList( - $value, - array( - ManiphestTaskPHIDType::TYPECONST, - )); - } - - public function getRequiredHandlePHIDsForCommitMessage() { - return $this->getRequiredHandlePHIDsForPropertyView(); - } - - public function renderCommitMessageValue(array $handles) { - return $this->renderObjectList($handles); - } - - public function getProTips() { - return array( - pht( - 'Write "%s" in your summary to automatically close the '. - 'corresponding task when this change lands.', - 'Fixes T123'), - ); - } - } diff --git a/src/applications/differential/customfield/DifferentialProjectReviewersField.php b/src/applications/differential/customfield/DifferentialProjectReviewersField.php index c900f72659..87ea0c34a3 100644 --- a/src/applications/differential/customfield/DifferentialProjectReviewersField.php +++ b/src/applications/differential/customfield/DifferentialProjectReviewersField.php @@ -57,13 +57,4 @@ final class DifferentialProjectReviewersField return $reviewers; } - public function getProTips() { - return array( - pht( - 'You can add a project as a subscriber or reviewer by writing '. - '"%s" in the appropriate field.', - '#projectname'), - ); - } - } diff --git a/src/applications/differential/editor/DifferentialRevisionEditEngine.php b/src/applications/differential/editor/DifferentialRevisionEditEngine.php index 382672b855..8e15238661 100644 --- a/src/applications/differential/editor/DifferentialRevisionEditEngine.php +++ b/src/applications/differential/editor/DifferentialRevisionEditEngine.php @@ -192,6 +192,21 @@ final class DifferentialRevisionEditEngine ->setConduitTypeDescription(pht('New repository.')) ->setSingleValue($object->getRepositoryPHID()); + // This is a little flimsy, but allows "Maniphest Tasks: ..." to continue + // working properly in commit messages until we fully sort out T5873. + $fields[] = id(new PhabricatorHandlesEditField()) + ->setKey('tasks') + ->setUseEdgeTransactions(true) + ->setIsConduitOnly(true) + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) + ->setMetadataValue( + 'edge:type', + DifferentialRevisionHasTaskEdgeType::EDGECONST) + ->setDescription(pht('Tasks associated with this revision.')) + ->setConduitDescription(pht('Change associated tasks.')) + ->setConduitTypeDescription(pht('List of tasks.')) + ->setValue(array()); + return $fields; } diff --git a/src/applications/differential/field/DifferentialCommitMessageField.php b/src/applications/differential/field/DifferentialCommitMessageField.php index e8478b6497..ebe10bcf88 100644 --- a/src/applications/differential/field/DifferentialCommitMessageField.php +++ b/src/applications/differential/field/DifferentialCommitMessageField.php @@ -182,7 +182,7 @@ abstract class DifferentialCommitMessageField protected function isCustomFieldEnabled($key) { $field_list = PhabricatorCustomField::getObjectFields( new DifferentialRevision(), - DifferentialCustomField::ROLE_COMMITMESSAGE); + DifferentialCustomField::ROLE_DEFAULT); $fields = $field_list->getFields(); return isset($fields[$key]); diff --git a/src/applications/differential/field/DifferentialTasksCommitMessageField.php b/src/applications/differential/field/DifferentialTasksCommitMessageField.php index 69101f5b95..eea0afef8d 100644 --- a/src/applications/differential/field/DifferentialTasksCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTasksCommitMessageField.php @@ -55,7 +55,11 @@ final class DifferentialTasksCommitMessageField } public function getFieldTransactions($value) { - // TODO: Implement this! - return array(); + return array( + array( + 'type' => 'tasks.set', + 'value' => $value, + ), + ); } } From 895cdaca5d1f1afdea565bc457a3b864b35c53e5 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 10:06:12 -0800 Subject: [PATCH 68/78] Simplify "Blame Revision" field in Differential Summary: Ref T11114. This is still mostly in use, but toss a few commit message parsing things. Test Plan: Viewed/edited/upated blame rev from CLI/web UI. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17089 --- .../DifferentialBlameRevisionField.php | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialBlameRevisionField.php b/src/applications/differential/customfield/DifferentialBlameRevisionField.php index 99915440c8..b2d8872225 100644 --- a/src/applications/differential/customfield/DifferentialBlameRevisionField.php +++ b/src/applications/differential/customfield/DifferentialBlameRevisionField.php @@ -32,6 +32,10 @@ final class DifferentialBlameRevisionField } public function renderPropertyViewValue(array $handles) { + if (!strlen($this->getValue())) { + return null; + } + return $this->getValue(); } @@ -91,25 +95,6 @@ final class DifferentialBlameRevisionField return true; } - public function shouldAllowEditInCommitMessage() { - return true; - } - - public function shouldOverwriteWhenCommitMessageIsEdited() { - return true; - } - - public function getCommitMessageLabels() { - return array( - 'Blame Revision', - 'Blame Rev', - ); - } - - public function renderCommitMessageValue(array $handles) { - return $this->getValue(); - } - public function shouldAppearInConduitDictionary() { return true; } From c6bdd2c56bab056599ddb015809fd7834e0b0a08 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 16 Dec 2016 12:08:43 -0800 Subject: [PATCH 69/78] Add Ngram support to Dashboards / Panels Summary: Build ngram indexs, adds search by name capability. Test Plan: Search for a dashboard by partial name, search for a panel by partial name. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17090 --- .../20161216.dashboard.ngram.01.sql | 15 +++++++++++++ .../20161216.dashboard.ngram.02.php | 21 +++++++++++++++++++ src/__phutil_library_map__.php | 6 ++++++ .../PhabricatorDashboardPanelEditEngine.php | 6 +++++- .../query/PhabricatorDashboardPanelQuery.php | 10 +++++++++ .../PhabricatorDashboardPanelSearchEngine.php | 8 +++++++ .../query/PhabricatorDashboardQuery.php | 10 +++++++++ .../PhabricatorDashboardSearchEngine.php | 8 +++++++ .../storage/PhabricatorDashboard.php | 15 +++++++++++-- .../storage/PhabricatorDashboardNgrams.php | 18 ++++++++++++++++ .../storage/PhabricatorDashboardPanel.php | 16 ++++++++++++-- .../PhabricatorDashboardPanelNgrams.php | 18 ++++++++++++++++ 12 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 resources/sql/autopatches/20161216.dashboard.ngram.01.sql create mode 100644 resources/sql/autopatches/20161216.dashboard.ngram.02.php create mode 100644 src/applications/dashboard/storage/PhabricatorDashboardNgrams.php create mode 100644 src/applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php diff --git a/resources/sql/autopatches/20161216.dashboard.ngram.01.sql b/resources/sql/autopatches/20161216.dashboard.ngram.01.sql new file mode 100644 index 0000000000..8fd237fe82 --- /dev/null +++ b/resources/sql/autopatches/20161216.dashboard.ngram.01.sql @@ -0,0 +1,15 @@ +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboard_ngrams ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + objectID INT UNSIGNED NOT NULL, + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT}, + KEY `key_object` (objectID), + KEY `key_ngram` (ngram, objectID) +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; + +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboardpanel_ngrams ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + objectID INT UNSIGNED NOT NULL, + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT}, + KEY `key_object` (objectID), + KEY `key_ngram` (ngram, objectID) +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20161216.dashboard.ngram.02.php b/resources/sql/autopatches/20161216.dashboard.ngram.02.php new file mode 100644 index 0000000000..a7abc99b23 --- /dev/null +++ b/resources/sql/autopatches/20161216.dashboard.ngram.02.php @@ -0,0 +1,21 @@ +getPHID(), + array( + 'force' => true, + )); +} + +$table_dbp = new PhabricatorDashboardPanel(); + +foreach (new LiskMigrationIterator($table_dbp) as $panel) { + PhabricatorSearchWorker::queueDocumentForIndexing( + $panel->getPHID(), + array( + 'force' => true, + )); +} diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 31fe6f0817..9b2b886ae9 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2445,6 +2445,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardListController' => 'applications/dashboard/controller/PhabricatorDashboardListController.php', 'PhabricatorDashboardManageController' => 'applications/dashboard/controller/PhabricatorDashboardManageController.php', 'PhabricatorDashboardMovePanelController' => 'applications/dashboard/controller/PhabricatorDashboardMovePanelController.php', + 'PhabricatorDashboardNgrams' => 'applications/dashboard/storage/PhabricatorDashboardNgrams.php', 'PhabricatorDashboardPanel' => 'applications/dashboard/storage/PhabricatorDashboardPanel.php', 'PhabricatorDashboardPanelArchiveController' => 'applications/dashboard/controller/PhabricatorDashboardPanelArchiveController.php', 'PhabricatorDashboardPanelCoreCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelCoreCustomField.php', @@ -2456,6 +2457,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelEditproController' => 'applications/dashboard/controller/PhabricatorDashboardPanelEditproController.php', 'PhabricatorDashboardPanelHasDashboardEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardPanelHasDashboardEdgeType.php', 'PhabricatorDashboardPanelListController' => 'applications/dashboard/controller/PhabricatorDashboardPanelListController.php', + 'PhabricatorDashboardPanelNgrams' => 'applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php', 'PhabricatorDashboardPanelPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php', 'PhabricatorDashboardPanelQuery' => 'applications/dashboard/query/PhabricatorDashboardPanelQuery.php', 'PhabricatorDashboardPanelRenderController' => 'applications/dashboard/controller/PhabricatorDashboardPanelRenderController.php', @@ -7381,6 +7383,7 @@ phutil_register_library_map(array( 'PhabricatorFlaggableInterface', 'PhabricatorDestructibleInterface', 'PhabricatorProjectInterface', + 'PhabricatorNgramsInterface', ), 'PhabricatorDashboardAddPanelController' => 'PhabricatorDashboardController', 'PhabricatorDashboardApplication' => 'PhabricatorApplication', @@ -7399,6 +7402,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardListController' => 'PhabricatorDashboardController', 'PhabricatorDashboardManageController' => 'PhabricatorDashboardController', 'PhabricatorDashboardMovePanelController' => 'PhabricatorDashboardController', + 'PhabricatorDashboardNgrams' => 'PhabricatorSearchNgrams', 'PhabricatorDashboardPanel' => array( 'PhabricatorDashboardDAO', 'PhabricatorApplicationTransactionInterface', @@ -7406,6 +7410,7 @@ phutil_register_library_map(array( 'PhabricatorCustomFieldInterface', 'PhabricatorFlaggableInterface', 'PhabricatorDestructibleInterface', + 'PhabricatorNgramsInterface', ), 'PhabricatorDashboardPanelArchiveController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelCoreCustomField' => array( @@ -7420,6 +7425,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelEditproController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelHasDashboardEdgeType' => 'PhabricatorEdgeType', 'PhabricatorDashboardPanelListController' => 'PhabricatorDashboardController', + 'PhabricatorDashboardPanelNgrams' => 'PhabricatorSearchNgrams', 'PhabricatorDashboardPanelPHIDType' => 'PhabricatorPHIDType', 'PhabricatorDashboardPanelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorDashboardPanelRenderController' => 'PhabricatorDashboardController', diff --git a/src/applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php b/src/applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php index 48940dde60..c9be8bf013 100644 --- a/src/applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php +++ b/src/applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php @@ -28,12 +28,16 @@ final class PhabricatorDashboardPanelEditEngine return pht('Edit Dashboard Panels'); } + protected function supportsSearch() { + return true; + } + public function getSummaryText() { return pht('This engine is used to modify dashboard panels.'); } public function getEngineApplicationClass() { - return 'PhabricatorSearchApplication'; + return 'PhabricatorDashboardApplication'; } protected function newEditableObject() { diff --git a/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php b/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php index 6fbdb3d99c..ac72c9ce6f 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php +++ b/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php @@ -34,6 +34,12 @@ final class PhabricatorDashboardPanelQuery return $this; } + public function withNameNgrams($ngrams) { + return $this->withNgramsConstraint( + id(new PhabricatorDashboardPanelNgrams()), + $ngrams); + } + protected function loadPage() { return $this->loadStandardPage($this->newResultObject()); } @@ -95,4 +101,8 @@ final class PhabricatorDashboardPanelQuery return 'PhabricatorDashboardApplication'; } + protected function getPrimaryTableAlias() { + return 'dashboard_panel'; + } + } diff --git a/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php index d9fe25ab02..89e77997d8 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php @@ -38,12 +38,20 @@ final class PhabricatorDashboardPanelSearchEngine $query->withAuthorPHIDs($map['authorPHIDs']); } + if ($map['name'] !== null) { + $query->withNameNgrams($map['name']); + } + return $query; } protected function buildCustomSearchFields() { return array( + id(new PhabricatorSearchTextField()) + ->setLabel(pht('Name Contains')) + ->setKey('name') + ->setDescription(pht('Search for panels by name substring.')), id(new PhabricatorSearchDatasourceField()) ->setLabel(pht('Authored By')) ->setKey('authorPHIDs') diff --git a/src/applications/dashboard/query/PhabricatorDashboardQuery.php b/src/applications/dashboard/query/PhabricatorDashboardQuery.php index a250d646d0..a54cfbc47c 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardQuery.php +++ b/src/applications/dashboard/query/PhabricatorDashboardQuery.php @@ -41,6 +41,12 @@ final class PhabricatorDashboardQuery return $this; } + public function withNameNgrams($ngrams) { + return $this->withNgramsConstraint( + id(new PhabricatorDashboardNgrams()), + $ngrams); + } + protected function loadPage() { return $this->loadStandardPage($this->newResultObject()); } @@ -141,4 +147,8 @@ final class PhabricatorDashboardQuery return 'PhabricatorDashboardApplication'; } + protected function getPrimaryTableAlias() { + return 'dashboard'; + } + } diff --git a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php index 389bbb6bdc..c6c6ab1233 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php @@ -18,6 +18,10 @@ final class PhabricatorDashboardSearchEngine protected function buildCustomSearchFields() { return array( + id(new PhabricatorSearchTextField()) + ->setLabel(pht('Name Contains')) + ->setKey('name') + ->setDescription(pht('Search for dashboards by name substring.')), id(new PhabricatorSearchDatasourceField()) ->setLabel(pht('Authored By')) ->setKey('authorPHIDs') @@ -82,6 +86,10 @@ final class PhabricatorDashboardSearchEngine $query->withAuthorPHIDs($map['authorPHIDs']); } + if ($map['name'] !== null) { + $query->withNameNgrams($map['name']); + } + return $query; } diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php index abba22498f..b9e40a76f6 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboard.php +++ b/src/applications/dashboard/storage/PhabricatorDashboard.php @@ -9,7 +9,8 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO PhabricatorPolicyInterface, PhabricatorFlaggableInterface, PhabricatorDestructibleInterface, - PhabricatorProjectInterface { + PhabricatorProjectInterface, + PhabricatorNgramsInterface { protected $name; protected $authorPHID; @@ -63,7 +64,7 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO 'layoutConfig' => self::SERIALIZATION_JSON, ), self::CONFIG_COLUMN_SCHEMA => array( - 'name' => 'text255', + 'name' => 'sort255', 'status' => 'text32', 'icon' => 'text32', 'authorPHID' => 'phid', @@ -186,4 +187,14 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO } +/* -( PhabricatorNgramInterface )------------------------------------------ */ + + + public function newNgrams() { + return array( + id(new PhabricatorDashboardNgrams()) + ->setValue($this->getName()), + ); + } + } diff --git a/src/applications/dashboard/storage/PhabricatorDashboardNgrams.php b/src/applications/dashboard/storage/PhabricatorDashboardNgrams.php new file mode 100644 index 0000000000..7884ec43f9 --- /dev/null +++ b/src/applications/dashboard/storage/PhabricatorDashboardNgrams.php @@ -0,0 +1,18 @@ + self::SERIALIZATION_JSON, ), self::CONFIG_COLUMN_SCHEMA => array( - 'name' => 'text255', + 'name' => 'sort255', 'panelType' => 'text64', 'authorPHID' => 'phid', 'isArchived' => 'bool', @@ -197,4 +198,15 @@ final class PhabricatorDashboardPanel $this->saveTransaction(); } + +/* -( PhabricatorNgramInterface )------------------------------------------ */ + + + public function newNgrams() { + return array( + id(new PhabricatorDashboardPanelNgrams()) + ->setValue($this->getName()), + ); + } + } diff --git a/src/applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php b/src/applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php new file mode 100644 index 0000000000..536da8b751 --- /dev/null +++ b/src/applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php @@ -0,0 +1,18 @@ + Date: Fri, 16 Dec 2016 12:31:36 -0800 Subject: [PATCH 70/78] Rename Differenital "EditPro" controller back to "Edit" Summary: Ref T11114. We seem to be in reasonable shape here and I don't think anything needs to revert, so rename this back to boring old "edit". Test Plan: Created, updated, edited a revision via web UI. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17091 --- src/__phutil_library_map__.php | 4 ++-- .../application/PhabricatorDifferentialApplication.php | 6 +++--- ...ontroller.php => DifferentialRevisionEditController.php} | 2 +- .../controller/DifferentialRevisionViewController.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename src/applications/differential/controller/{DifferentialRevisionEditProController.php => DifferentialRevisionEditController.php} (96%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 9b2b886ae9..896745594a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -518,8 +518,8 @@ phutil_register_library_map(array( 'DifferentialRevisionDependedOnByRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependedOnByRevisionEdgeType.php', 'DifferentialRevisionDependsOnRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependsOnRevisionEdgeType.php', 'DifferentialRevisionEditConduitAPIMethod' => 'applications/differential/conduit/DifferentialRevisionEditConduitAPIMethod.php', + 'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php', 'DifferentialRevisionEditEngine' => 'applications/differential/editor/DifferentialRevisionEditEngine.php', - 'DifferentialRevisionEditProController' => 'applications/differential/controller/DifferentialRevisionEditProController.php', 'DifferentialRevisionFulltextEngine' => 'applications/differential/search/DifferentialRevisionFulltextEngine.php', 'DifferentialRevisionGraph' => 'infrastructure/graph/DifferentialRevisionGraph.php', 'DifferentialRevisionHasChildRelationship' => 'applications/differential/relationships/DifferentialRevisionHasChildRelationship.php', @@ -5183,8 +5183,8 @@ phutil_register_library_map(array( 'DifferentialRevisionDependedOnByRevisionEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionDependsOnRevisionEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', + 'DifferentialRevisionEditController' => 'DifferentialController', 'DifferentialRevisionEditEngine' => 'PhabricatorEditEngine', - 'DifferentialRevisionEditProController' => 'DifferentialController', 'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine', 'DifferentialRevisionGraph' => 'PhabricatorObjectGraph', 'DifferentialRevisionHasChildRelationship' => 'DifferentialRevisionRelationship', diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php index b84da25e52..b5a3ea95dc 100644 --- a/src/applications/differential/application/PhabricatorDifferentialApplication.php +++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php @@ -65,10 +65,10 @@ final class PhabricatorDifferentialApplication extends PhabricatorApplication { ), 'changeset/' => 'DifferentialChangesetViewController', 'revision/' => array( - $this->getEditRoutePattern('editpro/') - => 'DifferentialRevisionEditProController', + $this->getEditRoutePattern('edit/') + => 'DifferentialRevisionEditController', $this->getEditRoutePattern('attach/(?P[^/]+)/to/') - => 'DifferentialRevisionEditProController', + => 'DifferentialRevisionEditController', 'land/(?:(?P[1-9]\d*))/(?P[^/]+)/' => 'DifferentialRevisionLandController', 'closedetails/(?P[^/]+)/' diff --git a/src/applications/differential/controller/DifferentialRevisionEditProController.php b/src/applications/differential/controller/DifferentialRevisionEditController.php similarity index 96% rename from src/applications/differential/controller/DifferentialRevisionEditProController.php rename to src/applications/differential/controller/DifferentialRevisionEditController.php index d61a6e4c0b..48fea82f7c 100644 --- a/src/applications/differential/controller/DifferentialRevisionEditProController.php +++ b/src/applications/differential/controller/DifferentialRevisionEditController.php @@ -1,6 +1,6 @@ addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') - ->setHref("/differential/revision/editpro/{$revision_id}/") + ->setHref("/differential/revision/edit/{$revision_id}/") ->setName(pht('Edit Revision')) ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit)); From 5e6afa97bc45aa52d028420661255e3cb08be46e Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 16 Dec 2016 13:01:20 -0800 Subject: [PATCH 71/78] Add a Dashboard MenuItem Summary: Built similar to Projects, allows setting of a Dashboard to MenuItem. Test Plan: Add a dashboard with and without a name / icon to a Project. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17092 --- src/__phutil_library_map__.php | 2 + .../storage/PhabricatorDashboard.php | 4 + .../PhabricatorDashboardProfileMenuItem.php | 112 ++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 896745594a..b3438afc96 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2471,6 +2471,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelTransactionQuery' => 'applications/dashboard/query/PhabricatorDashboardPanelTransactionQuery.php', 'PhabricatorDashboardPanelType' => 'applications/dashboard/paneltype/PhabricatorDashboardPanelType.php', 'PhabricatorDashboardPanelViewController' => 'applications/dashboard/controller/PhabricatorDashboardPanelViewController.php', + 'PhabricatorDashboardProfileMenuItem' => 'applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php', 'PhabricatorDashboardQuery' => 'applications/dashboard/query/PhabricatorDashboardQuery.php', 'PhabricatorDashboardQueryPanelType' => 'applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php', 'PhabricatorDashboardRemarkupRule' => 'applications/dashboard/remarkup/PhabricatorDashboardRemarkupRule.php', @@ -7439,6 +7440,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'PhabricatorDashboardPanelType' => 'Phobject', 'PhabricatorDashboardPanelViewController' => 'PhabricatorDashboardController', + 'PhabricatorDashboardProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorDashboardQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorDashboardQueryPanelType' => 'PhabricatorDashboardPanelType', 'PhabricatorDashboardRemarkupRule' => 'PhabricatorObjectRemarkupRule', diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php index b9e40a76f6..fb50cba692 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboard.php +++ b/src/applications/dashboard/storage/PhabricatorDashboard.php @@ -120,6 +120,10 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO return ($this->getStatus() == self::STATUS_ARCHIVED); } + public function getViewURI() { + return '/dashboard/view/'.$this->getID().'/'; + } + /* -( PhabricatorApplicationTransactionInterface )------------------------- */ diff --git a/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php new file mode 100644 index 0000000000..9074b1b117 --- /dev/null +++ b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php @@ -0,0 +1,112 @@ +dashboard = $dashboard; + return $this; + } + + public function getDashboard() { + $dashboard = $this->dashboard; + if (!$dashboard) { + return null; + } else if ($dashboard->isArchived()) { + return null; + } + return $dashboard; + } + + public function willBuildNavigationItems(array $items) { + $viewer = $this->getViewer(); + $dashboard_phids = array(); + foreach ($items as $item) { + $dashboard_phids[] = $item->getMenuItemProperty('dashboardPHID'); + } + + $dashboards = id(new PhabricatorDashboardQuery()) + ->setViewer($viewer) + ->withPHIDs($dashboard_phids) + ->execute(); + + $dashboards = mpull($dashboards, null, 'getPHID'); + foreach ($items as $item) { + $dashboard_phid = $item->getMenuItemProperty('dashboardPHID'); + $dashboard = idx($dashboards, $dashboard_phid, null); + $item->getMenuItem()->attachDashboard($dashboard); + } + } + + public function getDisplayName( + PhabricatorProfileMenuItemConfiguration $config) { + $dashboard = $this->getDashboard(); + if (!$dashboard) { + return pht('(Restricted/Invalid Dashboard)'); + } + if (strlen($this->getName($config))) { + return $this->getName($config); + } else { + return $dashboard->getName(); + } + } + + public function buildEditEngineFields( + PhabricatorProfileMenuItemConfiguration $config) { + return array( + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setValue($this->getName($config)), + id(new PhabricatorDatasourceEditField()) + ->setKey('dashboardPHID') + ->setLabel(pht('Dashboard')) + ->setDatasource(new PhabricatorDashboardDatasource()) + ->setSingleValue($config->getMenuItemProperty('dashboardPHID')), + ); + } + + private function getName( + PhabricatorProfileMenuItemConfiguration $config) { + return $config->getMenuItemProperty('name'); + } + + protected function newNavigationMenuItems( + PhabricatorProfileMenuItemConfiguration $config) { + + $dashboard = $this->getDashboard(); + if (!$dashboard) { + return array(); + } + + $icon = $dashboard->getIcon(); + $name = $this->getDisplayName($config); + $href = $dashboard->getViewURI(); + + $item = $this->newItem() + ->setHref($href) + ->setName($name) + ->setIcon($icon); + + return array( + $item, + ); + } + +} From 178466b82618fbfe61f508a3a9e5a5fcd0d45859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Santoro?= Date: Mon, 19 Dec 2016 12:52:46 -0800 Subject: [PATCH 72/78] Fix 20160122.project.1.boarddefault.php database upgrade patch Summary: Fixes T12031. Test Plan: Upgraded a December 2015 Phabricator installation to current schema. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T12031 Differential Revision: https://secure.phabricator.com/D17094 --- .../sql/autopatches/20160122.project.1.boarddefault.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/sql/autopatches/20160122.project.1.boarddefault.php b/resources/sql/autopatches/20160122.project.1.boarddefault.php index 500c820827..0ffce8d834 100644 --- a/resources/sql/autopatches/20160122.project.1.boarddefault.php +++ b/resources/sql/autopatches/20160122.project.1.boarddefault.php @@ -50,9 +50,9 @@ foreach (new LiskMigrationIterator($project_table) as $project) { $panel_table->getTableName(), $panel_table->generatePHID(), $project->getPHID(), - PhabricatorProjectWorkboardProfilePanel::PANELKEY, - PhabricatorProject::PANEL_WORKBOARD, - PhabricatorProfilePanelConfiguration::VISIBILITY_DEFAULT, + PhabricatorProjectWorkboardProfileMenuItem::MENUITEMKEY, + PhabricatorProject::ITEM_WORKBOARD, + PhabricatorProfileMenuItemConfiguration::VISIBILITY_DEFAULT, '{}', 2, PhabricatorTime::getNow(), From 01ac745d9d802019e1569d3e2579388dbb3fc892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Santoro?= Date: Mon, 19 Dec 2016 17:56:27 -0800 Subject: [PATCH 73/78] Fixed typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: In Settings > Set VCS Pasword: artisinal → artisanal Test Plan: Read again the sentence. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17095 --- .../diffusion/panel/DiffusionSetPasswordSettingsPanel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php b/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php index 1c42fb027b..4c84d430cf 100644 --- a/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php +++ b/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php @@ -186,7 +186,7 @@ final class DiffusionSetPasswordSettingsPanel extends PhabricatorSettingsPanel { $form->appendRemarkupInstructions( pht( 'Having trouble coming up with a good password? Try this '. - 'artisinal password, hand made in small batches by our expert '. + 'artisanal password, hand made in small batches by our expert '. 'craftspeople: '. "\n\n". "`%s`", From ed9b7eb38c8753cfebf27be5136a21877b5ee223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Santoro?= Date: Mon, 19 Dec 2016 18:00:13 -0800 Subject: [PATCH 74/78] Fix typo in Drydock user documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: disussion → discussion Test Plan: Read again the sentence. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17096 --- src/docs/user/userguide/drydock_blueprints.diviner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/user/userguide/drydock_blueprints.diviner b/src/docs/user/userguide/drydock_blueprints.diviner index 46c8a27f5e..21c4342fa6 100644 --- a/src/docs/user/userguide/drydock_blueprints.diviner +++ b/src/docs/user/userguide/drydock_blueprints.diviner @@ -14,7 +14,7 @@ Drydock builds and manages various hardware and software resources, like hosts and repository working copies. Other applications can use these resources to perform useful work (like running tests or builds). -For additional disussion of Drydock, see @{article:Drydock User Guide}. +For additional discussion of Drydock, see @{article:Drydock User Guide}. Drydock can't create any resources until you configure it. You'll configure Drydock by creating **Blueprints**. Each blueprint tells Drydock how to build From 8640ab5fc3e450efdbca4adb3601c7e60f048e36 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 20 Dec 2016 05:39:09 -0800 Subject: [PATCH 75/78] Redirect `/source/x` (no slash) to `/source/x/` (canonical) when viewer is logged out and "x" is public Summary: Fixes T12035. Normally, the "abc" -> "abc/" redirect is handled automatically when "abc" hits a 404. However, in this case, "source/x" does not 404. We route this to a valid controller because some VCS requests omit the slashes, then manually perform the redirect if we aren't serving a VCS request. Allow this controller to serve public resources so we can serve the redirect to logged-out users instead of prompting them to login so they can be redirected. Test Plan: Visited `/source/x` as a logged-out user, where `x` is a public repository. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12035 Differential Revision: https://secure.phabricator.com/D17097 --- .../controller/DiffusionRepositoryDefaultController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/applications/diffusion/controller/DiffusionRepositoryDefaultController.php b/src/applications/diffusion/controller/DiffusionRepositoryDefaultController.php index efebd12c6f..a83829ccc4 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryDefaultController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryDefaultController.php @@ -2,6 +2,15 @@ final class DiffusionRepositoryDefaultController extends DiffusionController { + public function shouldAllowPublic() { + // NOTE: We allow public access to this controller because it handles + // redirecting paths that are missing a trailing "/". We need to manually + // redirect these instead of relying on the automatic redirect because + // some VCS requests may omit the slashes. See T12035, and below, for some + // discussion. + return true; + } + public function handleRequest(AphrontRequest $request) { $response = $this->loadDiffusionContext(); if ($response) { From 972604e0e59ca0dd43cac7fe8e83574ba2870b3f Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 15 Dec 2016 13:36:06 -0800 Subject: [PATCH 76/78] Set `TERM` to prevent `No entry for terminal type "unknown"` messages during fetch Summary: Fetches cause output in `/var/tmp/phd/log/daemons.log` as follows: ``` PHLOG: 'Unexpected output while updating repository "rREPONAME": No entry for terminal type "unknown"; using dumb terminal settings. ' at [/path/to/phabricator/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php:455] ``` These warnings come from PHP itself. Silence these warnings by providing a known value for `TERM` before shelling out to the PHP script. See also D9744 (reverted in D11644) and T4990/T7119, which are a similar issue, but in the pre-receive hooks, not the pull daemons. Test Plan: Enabled in production, observed errors to be silenced and no SSH hangs Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D17100 --- .../daemon/PhabricatorRepositoryPullLocalDaemon.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php index 9cbb8db8e9..fe19849163 100644 --- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php +++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php @@ -272,6 +272,11 @@ final class PhabricatorRepositoryPullLocalDaemon $future->setTimeout($timeout); + // The default TERM inherited by this process is "unknown", which causes PHP + // to produce a warning upon startup. Override it to squash this output to + // STDERR. + $future->updateEnv('TERM', 'dumb'); + return $future; } From 5bdc7dd07b6c94a01bde8455dfecef63dbeac08f Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 22 Dec 2016 22:01:01 +0000 Subject: [PATCH 77/78] Minor style updates to Phame Summary: More obvious crumbs, remove border on images, better image spacing. Test Plan: Build out a test blog, click on crumbs, view spacing. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17101 --- resources/celerity/map.php | 4 ++-- webroot/rsrc/css/application/phame/phame.css | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index b85ec8d42b..db83e57fc0 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -83,7 +83,7 @@ return array( 'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b', 'rsrc/css/application/paste/paste.css' => '1898e534', 'rsrc/css/application/people/people-profile.css' => '2473d929', - 'rsrc/css/application/phame/phame.css' => '654dd9ef', + 'rsrc/css/application/phame/phame.css' => 'aeb61182', 'rsrc/css/application/pholio/pholio-edit.css' => '07676f51', 'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49', 'rsrc/css/application/pholio/pholio.css' => 'ca89d380', @@ -827,7 +827,7 @@ return array( 'phabricator-uiexample-reactor-sendclass' => '1def2711', 'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee', 'phabricator-zindex-css' => 'd1270942', - 'phame-css' => '654dd9ef', + 'phame-css' => 'aeb61182', 'pholio-css' => 'ca89d380', 'pholio-edit-css' => '07676f51', 'pholio-inline-comments-css' => '8e545e49', diff --git a/webroot/rsrc/css/application/phame/phame.css b/webroot/rsrc/css/application/phame/phame.css index 6a9a5b5717..7b20009356 100644 --- a/webroot/rsrc/css/application/phame/phame.css +++ b/webroot/rsrc/css/application/phame/phame.css @@ -23,7 +23,6 @@ display: inline-block; background-repeat: no-repeat; background-size: 100%; - box-shadow: inset 0 0 0 1px rgba({$alphagrey},.15); width: 40px; height: 40px; border-radius: 3px; @@ -98,7 +97,6 @@ display: inline-block; background-repeat: no-repeat; background-size: 100%; - box-shadow: inset 0 0 0 1px rgba({$alphagrey},.15); width: 24px; height: 24px; border-radius: 3px; @@ -253,14 +251,16 @@ /* Blog Chrome */ .phame-live-view .phui-crumbs-view { - background: #fff; border: none; - padding-left: 8px; + width: 960px; + margin: 0 auto; + padding: 4px 0; } /* Hero Image */ .phame-header-hero { background-color: #fff; + margin-top: 16px; } .phame-header-image { From 065d865bce0dd681e638c6577cb865fcc16de238 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 23 Dec 2016 07:16:03 -0800 Subject: [PATCH 78/78] In the "Version Information" panel, try to include branchpoints Summary: Fixes T12040. In T12039, a user running local patches followed the report instructions as far as grabbing version information, but didn't update or revert their local changes or try against a clean install before reporting. This obviously isn't ideal for us, but it's understandable (grabbing version information is much easier than upgrading/reverting), and we can do better about making this information useful: when compiling version information, try to figure out the branchpoint from a known upstream `master` branch by listing remotes, then running `git merge-base` against them. Additionally, explicitly document that we want upstream hashes. We have to have a fallback case in this document anyway (for when you can't get to Config) so hopefully this makes it more likely that we get useful information in initial reports. Test Plan: {F2229574} Reviewers: chad Reviewed By: chad Maniphest Tasks: T12040 Differential Revision: https://secure.phabricator.com/D17103 --- .../PhabricatorConfigVersionController.php | 141 +++++++++++++++++- src/docs/contributor/version.diviner | 23 +++ 2 files changed, 157 insertions(+), 7 deletions(-) diff --git a/src/applications/config/controller/PhabricatorConfigVersionController.php b/src/applications/config/controller/PhabricatorConfigVersionController.php index 15877ddbd7..8f43192b3b 100644 --- a/src/applications/config/controller/PhabricatorConfigVersionController.php +++ b/src/applications/config/controller/PhabricatorConfigVersionController.php @@ -39,8 +39,20 @@ final class PhabricatorConfigVersionController $versions = $this->loadVersions($viewer); $version_property_list = id(new PHUIPropertyListView()); - foreach ($versions as $name => $version) { - $version_property_list->addProperty($name, $version); + foreach ($versions as $name => $info) { + $version = $info['version']; + + if ($info['branchpoint']) { + $display = pht( + '%s (branched from %s on %s)', + $version, + $info['branchpoint'], + $info['upstream']); + } else { + $display = $version; + } + + $version_property_list->addProperty($name, $display); } $phabricator_root = dirname(phutil_get_library_root('phabricator')); @@ -67,16 +79,109 @@ final class PhabricatorConfigVersionController $other_libraries = array_diff($all_libraries, $specs); $specs = array_merge($specs, $other_libraries); - $futures = array(); + $log_futures = array(); + $remote_futures = array(); + foreach ($specs as $lib) { $root = dirname(phutil_get_library_root($lib)); - $futures[$lib] = - id(new ExecFuture('git log --format=%s -n 1 --', '%H %ct')) + + $log_command = csprintf( + 'git log --format=%s -n 1 --', + '%H %ct'); + + $remote_command = csprintf( + 'git remote -v'); + + $log_futures[$lib] = id(new ExecFuture('%C', $log_command)) + ->setCWD($root); + + $remote_futures[$lib] = id(new ExecFuture('%C', $remote_command)) ->setCWD($root); } + $all_futures = array_merge($log_futures, $remote_futures); + + id(new FutureIterator($all_futures)) + ->resolveAll(); + + // A repository may have a bunch of remotes, but we're only going to look + // for remotes we host to try to figure out where this repository branched. + $upstream_pattern = '(github\.com/phacility/|secure\.phabricator\.com/)'; + + $upstream_futures = array(); + $lib_upstreams = array(); + foreach ($specs as $lib) { + $remote_future = $remote_futures[$lib]; + + list($err, $stdout) = $remote_future->resolve(); + if ($err) { + // If this fails for whatever reason, just move on. + continue; + } + + // These look like this, with a tab separating the first two fields: + // remote-name http://remote.uri/ (push) + + $upstreams = array(); + + $remotes = phutil_split_lines($stdout, false); + foreach ($remotes as $remote) { + $remote_pattern = '/^([^\t]+)\t([^ ]+) \(([^)]+)\)\z/'; + $matches = null; + if (!preg_match($remote_pattern, $remote, $matches)) { + continue; + } + + // Remote URIs are either "push" or "fetch": we only care about "fetch" + // URIs. + $type = $matches[3]; + if ($type != 'fetch') { + continue; + } + + $uri = $matches[2]; + $is_upstream = preg_match($upstream_pattern, $uri); + if (!$is_upstream) { + continue; + } + + $name = $matches[1]; + $upstreams[$name] = $name; + } + + // If we have several suitable upstreams, try to pick the one named + // "origin", if it exists. Otherwise, just pick the first one. + if (isset($upstreams['origin'])) { + $upstream = $upstreams['origin']; + } else if ($upstreams) { + $upstream = head($upstreams); + } else { + $upstream = null; + } + + if (!$upstream) { + continue; + } + + $lib_upstreams[$lib] = $upstream; + + $merge_base_command = csprintf( + 'git merge-base HEAD %s/master --', + $upstream); + + $root = dirname(phutil_get_library_root($lib)); + + $upstream_futures[$lib] = id(new ExecFuture('%C', $merge_base_command)) + ->setCWD($root); + } + + if ($upstream_futures) { + id(new FutureIterator($upstream_futures)) + ->resolveAll(); + } + $results = array(); - foreach ($futures as $key => $future) { + foreach ($log_futures as $lib => $future) { list($err, $stdout) = $future->resolve(); if (!$err) { list($hash, $epoch) = explode(' ', $stdout); @@ -84,7 +189,29 @@ final class PhabricatorConfigVersionController } else { $version = pht('Unknown'); } - $results[$key] = $version; + + $result = array( + 'version' => $version, + 'upstream' => null, + 'branchpoint' => null, + ); + + $upstream_future = idx($upstream_futures, $lib); + if ($upstream_future) { + list($err, $stdout) = $upstream_future->resolve(); + if (!$err) { + $branchpoint = trim($stdout); + if (strlen($branchpoint)) { + // We only list a branchpoint if it differs from HEAD. + if ($branchpoint != $hash) { + $result['upstream'] = $lib_upstreams[$lib]; + $result['branchpoint'] = trim($stdout); + } + } + } + } + + $results[$lib] = $result; } return $results; diff --git a/src/docs/contributor/version.diviner b/src/docs/contributor/version.diviner index 81b1c845ef..a13c12d86f 100644 --- a/src/docs/contributor/version.diviner +++ b/src/docs/contributor/version.diviner @@ -49,6 +49,29 @@ hash from the output. This may be useful if you're encountering an issue which prevents you from reaching the version reporting screen. +Running a Fork? +=============== + +If you've forked Phabricator and have local commits, please make sure you are +reporting upstream commit hashes, not local commit hashes. The UI will attempt +to figure out where you branched from, but it may not be able to in all cases. + +If you report local commit hashes instead of upstream commit hashes we can not +go look up the commit hashes to figure out which changes they correspond to, so +we can not use that information to determine out how old your install is or +which patches you are missing. + +In most cases, you can find the upstream commit you've branched from like this: + +``` +$ git merge-base HEAD origin/master +```` + +Note that if you report a bug and have local commits, we will almost always ask +you to reproduce the issue against a clean copy of Phabricator before we +continue. You can get help faster by doing this //before// reporting an issue. + + Next Steps ==========