Page MenuHomePhabricator

D17215.id41412.diff
No OneTemporary

D17215.id41412.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2668,7 +2668,6 @@
'PhabricatorFactSpec' => 'applications/fact/spec/PhabricatorFactSpec.php',
'PhabricatorFactUpdateIterator' => 'applications/fact/extract/PhabricatorFactUpdateIterator.php',
'PhabricatorFavoritesApplication' => 'applications/favorites/application/PhabricatorFavoritesApplication.php',
- 'PhabricatorFavoritesConstants' => 'applications/favorites/constants/PhabricatorFavoritesConstants.php',
'PhabricatorFavoritesController' => 'applications/favorites/controller/PhabricatorFavoritesController.php',
'PhabricatorFavoritesMainController' => 'applications/favorites/controller/PhabricatorFavoritesMainController.php',
'PhabricatorFavoritesMenuItemController' => 'applications/favorites/controller/PhabricatorFavoritesMenuItemController.php',
@@ -7683,7 +7682,6 @@
'PhabricatorFactSpec' => 'Phobject',
'PhabricatorFactUpdateIterator' => 'PhutilBufferedIterator',
'PhabricatorFavoritesApplication' => 'PhabricatorApplication',
- 'PhabricatorFavoritesConstants' => 'PhabricatorFavoritesController',
'PhabricatorFavoritesController' => 'PhabricatorController',
'PhabricatorFavoritesMainController' => 'PhabricatorFavoritesController',
'PhabricatorFavoritesMenuItemController' => 'PhabricatorFavoritesController',
diff --git a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
--- a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
+++ b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
@@ -20,6 +20,10 @@
return false;
}
+ public function isDefaultQuickCreateEngine() {
+ return true;
+ }
+
public function getEngineName() {
return pht('Repositories');
}
diff --git a/src/applications/favorites/constants/PhabricatorFavoritesConstants.php b/src/applications/favorites/constants/PhabricatorFavoritesConstants.php
deleted file mode 100644
--- a/src/applications/favorites/constants/PhabricatorFavoritesConstants.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-final class PhabricatorFavoritesConstants
- extends PhabricatorFavoritesController {
-
- const ITEM_TASK = 'favorites.task';
- const ITEM_PROJECT = 'favorites.project';
- const ITEM_REPOSITORY = 'favorites.repository';
- const ITEM_DIVIDER = 'favorites.divider';
-
-}
diff --git a/src/applications/favorites/engine/PhabricatorFavoritesProfileMenuEngine.php b/src/applications/favorites/engine/PhabricatorFavoritesProfileMenuEngine.php
--- a/src/applications/favorites/engine/PhabricatorFavoritesProfileMenuEngine.php
+++ b/src/applications/favorites/engine/PhabricatorFavoritesProfileMenuEngine.php
@@ -22,38 +22,25 @@
$items = array();
$viewer = $this->getViewer();
- $create_task = array(
- 'name' => null,
- 'formKey' =>
- id(new ManiphestEditEngine())->getProfileMenuItemDefault(),
- );
-
- $create_project = array(
- 'name' => null,
- 'formKey' =>
- id(new PhabricatorProjectEditEngine())->getProfileMenuItemDefault(),
- );
-
- $create_repository = array(
- 'name' => null,
- 'formKey' =>
- id(new DiffusionRepositoryEditEngine())->getProfileMenuItemDefault(),
- );
-
- $items[] = $this->newItem()
- ->setBuiltinKey(PhabricatorFavoritesConstants::ITEM_TASK)
- ->setMenuItemKey(PhabricatorEditEngineProfileMenuItem::MENUITEMKEY)
- ->setMenuItemProperties($create_task);
-
- $items[] = $this->newItem()
- ->setBuiltinKey(PhabricatorFavoritesConstants::ITEM_PROJECT)
- ->setMenuItemKey(PhabricatorEditEngineProfileMenuItem::MENUITEMKEY)
- ->setMenuItemProperties($create_project);
-
- $items[] = $this->newItem()
- ->setBuiltinKey(PhabricatorFavoritesConstants::ITEM_REPOSITORY)
- ->setMenuItemKey(PhabricatorEditEngineProfileMenuItem::MENUITEMKEY)
- ->setMenuItemProperties($create_repository);
+ $engines = PhabricatorEditEngine::getAllEditEngines();
+ $engines = msortv($engines, 'getQuickCreateOrderVector');
+
+ foreach ($engines as $engine) {
+ foreach ($engine->getDefaultQuickCreateFormKeys() as $form_key) {
+ $form_hash = PhabricatorHash::digestForIndex($form_key);
+ $builtin_key = "editengine.form({$form_hash})";
+
+ $properties = array(
+ 'name' => null,
+ 'formKey' => $form_key,
+ );
+
+ $items[] = $this->newItem()
+ ->setBuiltinKey($builtin_key)
+ ->setMenuItemKey(PhabricatorEditEngineProfileMenuItem::MENUITEMKEY)
+ ->setMenuItemProperties($properties);
+ }
+ }
return $items;
}
diff --git a/src/applications/maniphest/editor/ManiphestEditEngine.php b/src/applications/maniphest/editor/ManiphestEditEngine.php
--- a/src/applications/maniphest/editor/ManiphestEditEngine.php
+++ b/src/applications/maniphest/editor/ManiphestEditEngine.php
@@ -21,6 +21,10 @@
return 'PhabricatorManiphestApplication';
}
+ public function isDefaultQuickCreateEngine() {
+ return true;
+ }
+
protected function newEditableObject() {
return ManiphestTask::initializeNewTask($this->getViewer());
}
diff --git a/src/applications/project/engine/PhabricatorProjectEditEngine.php b/src/applications/project/engine/PhabricatorProjectEditEngine.php
--- a/src/applications/project/engine/PhabricatorProjectEditEngine.php
+++ b/src/applications/project/engine/PhabricatorProjectEditEngine.php
@@ -26,6 +26,10 @@
return $this->milestoneProject;
}
+ public function isDefaultQuickCreateEngine() {
+ return true;
+ }
+
public function getEngineName() {
return pht('Projects');
}
diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php
--- a/src/applications/transactions/editengine/PhabricatorEditEngine.php
+++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php
@@ -77,6 +77,29 @@
return true;
}
+ public function isDefaultQuickCreateEngine() {
+ return false;
+ }
+
+ public function getDefaultQuickCreateFormKeys() {
+ $keys = array();
+
+ if ($this->isDefaultQuickCreateEngine()) {
+ $keys[] = self::EDITENGINECONFIG_DEFAULT;
+ }
+
+ foreach ($keys as $idx => $key) {
+ $keys[$idx] = $this->getEngineKey().'/'.$key;
+ }
+
+ return $keys;
+ }
+
+ public function getQuickCreateOrderVector() {
+ return id(new PhutilSortVector())
+ ->addString($this->getObjectCreateShortText());
+ }
+
/**
* Force the engine to edit a particular object.
*/
@@ -107,10 +130,6 @@
return $this->hideHeader;
}
- public function getProfileMenuItemDefault() {
- return $this->getEngineKey().'/'.self::EDITENGINECONFIG_DEFAULT;
- }
-
/* -( Managing Fields )---------------------------------------------------- */
@@ -284,14 +303,6 @@
/**
- * @task text
- */
- protected function getQuickCreateMenuHeaderText() {
- return $this->getObjectCreateShortText();
- }
-
-
- /**
* Return a human-readable header describing what this engine is used to do,
* like "Configure Maniphest Task Forms".
*
@@ -2100,50 +2111,6 @@
return $application->getIcon();
}
- public function hasQuickCreateActions() {
- if (!$this->isEngineConfigurable()) {
- return false;
- }
-
- return true;
- }
-
- public function newQuickCreateActions(array $configs) {
- $items = array();
-
- if (!$configs) {
- return array();
- }
-
- // If the viewer is logged in and can't create objects, don't show the
- // menu item. If they're logged out, we assume they could create objects
- // if they logged in, so we show the item as a hint about how to
- // accomplish the action.
- if ($this->getViewer()->isLoggedIn()) {
- if (!$this->hasCreateCapability()) {
- return array();
- }
- }
-
- if (count($configs) == 1) {
- $config = head($configs);
- $items[] = $this->newQuickCreateAction($config);
- } else {
- $group_name = $this->getQuickCreateMenuHeaderText();
-
- $items[] = id(new PHUIListItemView())
- ->setType(PHUIListItemView::TYPE_LABEL)
- ->setName($group_name);
-
- foreach ($configs as $config) {
- $items[] = $this->newQuickCreateAction($config)
- ->setIndented(true);
- }
- }
-
- return $items;
- }
-
private function loadUsableConfigurationsForCreate() {
$viewer = $this->getViewer();
@@ -2159,20 +2126,6 @@
return $configs;
}
- private function newQuickCreateAction(
- PhabricatorEditEngineConfiguration $config) {
-
- $item_name = $config->getName();
- $item_icon = $config->getIcon();
- $form_key = $config->getIdentifier();
- $item_uri = $this->getEditURI(null, "form/{$form_key}/");
-
- return id(new PHUIListItemView())
- ->setName($item_name)
- ->setIcon($item_icon)
- ->setHref($item_uri);
- }
-
protected function getValidationExceptionShortMessage(
PhabricatorApplicationTransactionValidationException $ex,
PhabricatorEditField $field) {

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 3, 1:58 PM (2 d, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7707415
Default Alt Text
D17215.id41412.diff (9 KB)

Event Timeline