From 2ccf1a9e48e225da7ea4d32f21539cf9bdecbef6 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 15 Oct 2012 15:40:44 -0700 Subject: [PATCH] fix workflow to work with complicated content Summary: we were aggressively checking to make sure the event target was a workflow element. instead, just update the event target to the workflow element if necessary. could probably just do this unconditionally as well. Test Plan: D3705 works with this in place! Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3707 --- src/__celerity_resource_map__.php | 40 +++++++++---------- .../js/application/core/behavior-workflow.js | 12 ++---- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 3c800cff6b..cec1590579 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -1742,7 +1742,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-workflow' => array( - 'uri' => '/res/ce154288/rsrc/js/application/core/behavior-workflow.js', + 'uri' => '/res/fb94a030/rsrc/js/application/core/behavior-workflow.js', 'type' => 'js', 'requires' => array( @@ -3029,7 +3029,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/315e8536/core.pkg.css', 'type' => 'css', ), - '3a455e4f' => + '25356ea5' => array( 'name' => 'core.pkg.js', 'symbols' => @@ -3052,7 +3052,7 @@ celerity_register_resource_map(array( 15 => 'javelin-behavior-phabricator-tooltips', 16 => 'phabricator-prefab', ), - 'uri' => '/res/pkg/3a455e4f/core.pkg.js', + 'uri' => '/res/pkg/25356ea5/core.pkg.js', 'type' => 'js', ), '2ba14b3d' => @@ -3225,7 +3225,7 @@ celerity_register_resource_map(array( 'javelin-behavior-aphront-basic-tokenizer' => '81c9cd69', 'javelin-behavior-aphront-drag-and-drop' => 'a569df32', 'javelin-behavior-aphront-drag-and-drop-textarea' => 'a569df32', - 'javelin-behavior-aphront-form-disable-on-submit' => '3a455e4f', + 'javelin-behavior-aphront-form-disable-on-submit' => '25356ea5', 'javelin-behavior-audit-preview' => '5e68be89', 'javelin-behavior-differential-accept-with-errors' => 'a569df32', 'javelin-behavior-differential-add-reviewers-and-ccs' => 'a569df32', @@ -3244,20 +3244,20 @@ celerity_register_resource_map(array( 'javelin-behavior-maniphest-transaction-controls' => '7707de41', 'javelin-behavior-maniphest-transaction-expand' => '7707de41', 'javelin-behavior-maniphest-transaction-preview' => '7707de41', - 'javelin-behavior-phabricator-autofocus' => '3a455e4f', - 'javelin-behavior-phabricator-keyboard-shortcuts' => '3a455e4f', + 'javelin-behavior-phabricator-autofocus' => '25356ea5', + 'javelin-behavior-phabricator-keyboard-shortcuts' => '25356ea5', 'javelin-behavior-phabricator-object-selector' => 'a569df32', - 'javelin-behavior-phabricator-oncopy' => '3a455e4f', - 'javelin-behavior-phabricator-tooltips' => '3a455e4f', - 'javelin-behavior-phabricator-watch-anchor' => '3a455e4f', - 'javelin-behavior-refresh-csrf' => '3a455e4f', + 'javelin-behavior-phabricator-oncopy' => '25356ea5', + 'javelin-behavior-phabricator-tooltips' => '25356ea5', + 'javelin-behavior-phabricator-watch-anchor' => '25356ea5', + 'javelin-behavior-refresh-csrf' => '25356ea5', 'javelin-behavior-repository-crossreference' => 'a569df32', - 'javelin-behavior-workflow' => '3a455e4f', + 'javelin-behavior-workflow' => '25356ea5', 'javelin-dom' => '6c45a1d8', 'javelin-event' => '6c45a1d8', 'javelin-install' => '6c45a1d8', 'javelin-json' => '6c45a1d8', - 'javelin-mask' => '3a455e4f', + 'javelin-mask' => '25356ea5', 'javelin-request' => '6c45a1d8', 'javelin-stratcom' => '6c45a1d8', 'javelin-tokenizer' => '81c9cd69', @@ -3269,7 +3269,7 @@ celerity_register_resource_map(array( 'javelin-uri' => '6c45a1d8', 'javelin-util' => '6c45a1d8', 'javelin-vector' => '6c45a1d8', - 'javelin-workflow' => '3a455e4f', + 'javelin-workflow' => '25356ea5', 'maniphest-task-summary-css' => '7839ae2d', 'maniphest-transaction-detail-css' => '7839ae2d', 'phabricator-app-buttons-css' => '315e8536', @@ -3278,20 +3278,20 @@ celerity_register_resource_map(array( 'phabricator-core-css' => '315e8536', 'phabricator-directory-css' => '315e8536', 'phabricator-drag-and-drop-file-upload' => 'a569df32', - 'phabricator-dropdown-menu' => '3a455e4f', + 'phabricator-dropdown-menu' => '25356ea5', 'phabricator-flag-css' => '315e8536', 'phabricator-jump-nav' => '315e8536', - 'phabricator-keyboard-shortcut' => '3a455e4f', - 'phabricator-keyboard-shortcut-manager' => '3a455e4f', - 'phabricator-menu-item' => '3a455e4f', + 'phabricator-keyboard-shortcut' => '25356ea5', + 'phabricator-keyboard-shortcut-manager' => '25356ea5', + 'phabricator-menu-item' => '25356ea5', 'phabricator-object-selector-css' => '2ba14b3d', - 'phabricator-paste-file-upload' => '3a455e4f', - 'phabricator-prefab' => '3a455e4f', + 'phabricator-paste-file-upload' => '25356ea5', + 'phabricator-prefab' => '25356ea5', 'phabricator-project-tag-css' => '7839ae2d', 'phabricator-remarkup-css' => '315e8536', 'phabricator-shaped-request' => 'a569df32', 'phabricator-standard-page-view' => '315e8536', - 'phabricator-tooltip' => '3a455e4f', + 'phabricator-tooltip' => '25356ea5', 'phabricator-transaction-view-css' => '315e8536', 'syntax-highlighting-css' => '315e8536', ), diff --git a/webroot/rsrc/js/application/core/behavior-workflow.js b/webroot/rsrc/js/application/core/behavior-workflow.js index 895de4de10..9f916caff5 100644 --- a/webroot/rsrc/js/application/core/behavior-workflow.js +++ b/webroot/rsrc/js/application/core/behavior-workflow.js @@ -13,11 +13,9 @@ JX.behavior('workflow', function() { if (JX.Stratcom.pass()) { return; } - if (e.getNode('workflow') !== e.getTarget()) { - return; - } + var target = e.getNode('workflow'); e.prevent(); - JX.Workflow.newFromForm(e.getTarget()).start(); + JX.Workflow.newFromForm(target).start(); }); JX.Stratcom.listen( 'click', @@ -26,14 +24,12 @@ JX.behavior('workflow', function() { if (JX.Stratcom.pass()) { return; } - if (e.getNode('workflow') !== e.getTarget()) { - return; - } + var target = e.getNode('workflow'); var raw = e.getRawEvent(); if (raw.altKey || raw.ctrlKey || raw.metaKey || raw.shiftKey) { return; } e.prevent(); - JX.Workflow.newFromLink(e.getTarget()).start(); + JX.Workflow.newFromLink(target).start(); }); });