Page MenuHomePhabricator

D14806.id35795.diff
No OneTemporary

D14806.id35795.diff

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
@@ -1076,29 +1076,26 @@
final public function addActionToCrumbs(PHUICrumbsView $crumbs) {
$viewer = $this->getViewer();
- $can_create = $this->hasCreateCapability();
- if ($can_create) {
- $configs = $this->loadUsableConfigurationsForCreate();
- } else {
- $configs = array();
- }
+ $configs = $this->loadUsableConfigurationsForCreate();
$dropdown = null;
$disabled = false;
$workflow = false;
$menu_icon = 'fa-plus-square';
+ $can_create = $this->hasCreateCapability();
- if (!$configs) {
- if ($viewer->isLoggedIn()) {
- $disabled = true;
- } else {
- // If the viewer isn't logged in, assume they'll get hit with a login
- // dialog and are likely able to create objects after they log in.
- $disabled = false;
- }
+ // If the viewer isn't logged in, assume they'll get hit with a login
+ // dialog and are likely able to create objects after they log in.
+ if ($viewer->isLoggedIn()) {
+ $disabled = false;
$workflow = true;
+ } else {
+ $disabled = (!$can_create || !$configs);
+ $workflow = $disabled;
+ }
+ if (!$configs) {
if ($can_create) {
$create_uri = $this->getEditURI(null, 'nodefault/');
} else {
@@ -1110,11 +1107,11 @@
$create_uri = $this->getEditURI(null, "form/{$form_key}/");
if (count($configs) > 1) {
- $menu_icon = 'fa-caret-square-o-down';
-
$dropdown = id(new PhabricatorActionListView())
->setUser($viewer);
+ $menu_icon = 'fa-caret-square-o-down';
+
foreach ($configs as $config) {
$form_key = $config->getIdentifier();
$config_uri = $this->getEditURI(null, "form/{$form_key}/");
@@ -1125,8 +1122,14 @@
id(new PhabricatorActionView())
->setName($config->getDisplayName())
->setIcon($item_icon)
- ->setHref($config_uri));
+ ->setHref($config_uri)
+ ->setDisabled($disabled)
+ ->setWorkflow($workflow));
}
+
+ // If we made a dropdown menu, never put workflow on the action itself
+ // since we just want it to open the menu.
+ $workflow = false;
}
}

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 28, 4:08 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225801
Default Alt Text
D14806.id35795.diff (2 KB)

Event Timeline