@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a synthetic DOM event to JX.Workflow for form submission

Summary: Currently, when a dialog is submitted the Workflow itself emits an event but no DOM event is emitted. The workflow event is fine for handlers which only use JS, but there's currently no way for a handler to act more like a normal form handler. This event gives normal form handlers a way to capture Workflow submits and muck around with form contents, etc.

Test Plan: In a future diff, edited policies via a Workflow dialog.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7295

+77 -69
+66 -66
src/__celerity_resource_map__.php
··· 2295 2295 ), 2296 2296 'javelin-behavior-policy-rule-editor' => 2297 2297 array( 2298 - 'uri' => '/res/4ae4249d/rsrc/js/application/policy/behavior-policy-rule-editor.js', 2298 + 'uri' => '/res/4665236c/rsrc/js/application/policy/behavior-policy-rule-editor.js', 2299 2299 'type' => 'js', 2300 2300 'requires' => 2301 2301 array( ··· 2497 2497 ), 2498 2498 'javelin-behavior-workflow' => 2499 2499 array( 2500 - 'uri' => '/res/4a0595c1/rsrc/js/core/behavior-workflow.js', 2500 + 'uri' => '/res/144d3196/rsrc/js/core/behavior-workflow.js', 2501 2501 'type' => 'js', 2502 2502 'requires' => 2503 2503 array( ··· 2914 2914 ), 2915 2915 'javelin-workflow' => 2916 2916 array( 2917 - 'uri' => '/res/7626494b/rsrc/externals/javelin/lib/Workflow.js', 2917 + 'uri' => '/res/09a97dda/rsrc/externals/javelin/lib/Workflow.js', 2918 2918 'type' => 'js', 2919 2919 'requires' => 2920 2920 array( ··· 4309 4309 'uri' => '/res/pkg/0ed58ed4/core.pkg.css', 4310 4310 'type' => 'css', 4311 4311 ), 4312 - '9eabd244' => 4312 + 'adee86d9' => 4313 4313 array( 4314 4314 'name' => 'core.pkg.js', 4315 4315 'symbols' => ··· 4354 4354 37 => 'javelin-color', 4355 4355 38 => 'javelin-fx', 4356 4356 ), 4357 - 'uri' => '/res/pkg/9eabd244/core.pkg.js', 4357 + 'uri' => '/res/pkg/adee86d9/core.pkg.js', 4358 4358 'type' => 'js', 4359 4359 ), 4360 4360 '4ccfeb47' => ··· 4441 4441 'uri' => '/res/pkg/96909266/diffusion.pkg.js', 4442 4442 'type' => 'js', 4443 4443 ), 4444 - '9564fa17' => 4444 + '3e3be199' => 4445 4445 array( 4446 4446 'name' => 'javelin.pkg.js', 4447 4447 'symbols' => ··· 4467 4467 18 => 'javelin-tokenizer', 4468 4468 19 => 'javelin-history', 4469 4469 ), 4470 - 'uri' => '/res/pkg/9564fa17/javelin.pkg.js', 4470 + 'uri' => '/res/pkg/3e3be199/javelin.pkg.js', 4471 4471 'type' => 'js', 4472 4472 ), 4473 4473 49898640 => ··· 4522 4522 'diffusion-icons-css' => 'c8ce2d88', 4523 4523 'global-drag-and-drop-css' => '0ed58ed4', 4524 4524 'inline-comment-summary-css' => '4dc2311c', 4525 - 'javelin-aphlict' => '9eabd244', 4526 - 'javelin-behavior' => '9564fa17', 4527 - 'javelin-behavior-aphlict-dropdown' => '9eabd244', 4528 - 'javelin-behavior-aphlict-listen' => '9eabd244', 4529 - 'javelin-behavior-aphront-basic-tokenizer' => '9eabd244', 4525 + 'javelin-aphlict' => 'adee86d9', 4526 + 'javelin-behavior' => '3e3be199', 4527 + 'javelin-behavior-aphlict-dropdown' => 'adee86d9', 4528 + 'javelin-behavior-aphlict-listen' => 'adee86d9', 4529 + 'javelin-behavior-aphront-basic-tokenizer' => 'adee86d9', 4530 4530 'javelin-behavior-aphront-drag-and-drop-textarea' => '5e9e5c4e', 4531 - 'javelin-behavior-aphront-form-disable-on-submit' => '9eabd244', 4531 + 'javelin-behavior-aphront-form-disable-on-submit' => 'adee86d9', 4532 4532 'javelin-behavior-audit-preview' => '96909266', 4533 4533 'javelin-behavior-dark-console' => '4ccfeb47', 4534 - 'javelin-behavior-device' => '9eabd244', 4534 + 'javelin-behavior-device' => 'adee86d9', 4535 4535 'javelin-behavior-differential-accept-with-errors' => '5e9e5c4e', 4536 4536 'javelin-behavior-differential-add-reviewers-and-ccs' => '5e9e5c4e', 4537 4537 'javelin-behavior-differential-comment-jump' => '5e9e5c4e', ··· 4547 4547 'javelin-behavior-diffusion-commit-graph' => '96909266', 4548 4548 'javelin-behavior-diffusion-pull-lastmodified' => '96909266', 4549 4549 'javelin-behavior-error-log' => '4ccfeb47', 4550 - 'javelin-behavior-global-drag-and-drop' => '9eabd244', 4551 - 'javelin-behavior-history-install' => '9eabd244', 4552 - 'javelin-behavior-konami' => '9eabd244', 4553 - 'javelin-behavior-lightbox-attachments' => '9eabd244', 4550 + 'javelin-behavior-global-drag-and-drop' => 'adee86d9', 4551 + 'javelin-behavior-history-install' => 'adee86d9', 4552 + 'javelin-behavior-konami' => 'adee86d9', 4553 + 'javelin-behavior-lightbox-attachments' => 'adee86d9', 4554 4554 'javelin-behavior-load-blame' => '5e9e5c4e', 4555 4555 'javelin-behavior-maniphest-batch-selector' => '0a694954', 4556 4556 'javelin-behavior-maniphest-subpriority-editor' => '0a694954', 4557 4557 'javelin-behavior-maniphest-transaction-controls' => '0a694954', 4558 4558 'javelin-behavior-maniphest-transaction-expand' => '0a694954', 4559 4559 'javelin-behavior-maniphest-transaction-preview' => '0a694954', 4560 - 'javelin-behavior-phabricator-active-nav' => '9eabd244', 4561 - 'javelin-behavior-phabricator-autofocus' => '9eabd244', 4562 - 'javelin-behavior-phabricator-gesture' => '9eabd244', 4563 - 'javelin-behavior-phabricator-hovercards' => '9eabd244', 4564 - 'javelin-behavior-phabricator-keyboard-shortcuts' => '9eabd244', 4565 - 'javelin-behavior-phabricator-nav' => '9eabd244', 4560 + 'javelin-behavior-phabricator-active-nav' => 'adee86d9', 4561 + 'javelin-behavior-phabricator-autofocus' => 'adee86d9', 4562 + 'javelin-behavior-phabricator-gesture' => 'adee86d9', 4563 + 'javelin-behavior-phabricator-hovercards' => 'adee86d9', 4564 + 'javelin-behavior-phabricator-keyboard-shortcuts' => 'adee86d9', 4565 + 'javelin-behavior-phabricator-nav' => 'adee86d9', 4566 4566 'javelin-behavior-phabricator-object-selector' => '5e9e5c4e', 4567 - 'javelin-behavior-phabricator-oncopy' => '9eabd244', 4568 - 'javelin-behavior-phabricator-remarkup-assist' => '9eabd244', 4569 - 'javelin-behavior-phabricator-reveal-content' => '9eabd244', 4570 - 'javelin-behavior-phabricator-search-typeahead' => '9eabd244', 4571 - 'javelin-behavior-phabricator-tooltips' => '9eabd244', 4572 - 'javelin-behavior-phabricator-watch-anchor' => '9eabd244', 4573 - 'javelin-behavior-refresh-csrf' => '9eabd244', 4567 + 'javelin-behavior-phabricator-oncopy' => 'adee86d9', 4568 + 'javelin-behavior-phabricator-remarkup-assist' => 'adee86d9', 4569 + 'javelin-behavior-phabricator-reveal-content' => 'adee86d9', 4570 + 'javelin-behavior-phabricator-search-typeahead' => 'adee86d9', 4571 + 'javelin-behavior-phabricator-tooltips' => 'adee86d9', 4572 + 'javelin-behavior-phabricator-watch-anchor' => 'adee86d9', 4573 + 'javelin-behavior-refresh-csrf' => 'adee86d9', 4574 4574 'javelin-behavior-repository-crossreference' => '5e9e5c4e', 4575 - 'javelin-behavior-toggle-class' => '9eabd244', 4576 - 'javelin-behavior-workflow' => '9eabd244', 4577 - 'javelin-color' => '9eabd244', 4578 - 'javelin-dom' => '9564fa17', 4579 - 'javelin-event' => '9564fa17', 4580 - 'javelin-fx' => '9eabd244', 4581 - 'javelin-history' => '9564fa17', 4582 - 'javelin-install' => '9564fa17', 4583 - 'javelin-json' => '9564fa17', 4584 - 'javelin-mask' => '9564fa17', 4585 - 'javelin-request' => '9564fa17', 4586 - 'javelin-resource' => '9564fa17', 4587 - 'javelin-stratcom' => '9564fa17', 4588 - 'javelin-tokenizer' => '9564fa17', 4589 - 'javelin-typeahead' => '9564fa17', 4590 - 'javelin-typeahead-normalizer' => '9564fa17', 4591 - 'javelin-typeahead-ondemand-source' => '9564fa17', 4592 - 'javelin-typeahead-preloaded-source' => '9564fa17', 4593 - 'javelin-typeahead-source' => '9564fa17', 4594 - 'javelin-uri' => '9564fa17', 4595 - 'javelin-util' => '9564fa17', 4596 - 'javelin-vector' => '9564fa17', 4597 - 'javelin-workflow' => '9564fa17', 4575 + 'javelin-behavior-toggle-class' => 'adee86d9', 4576 + 'javelin-behavior-workflow' => 'adee86d9', 4577 + 'javelin-color' => 'adee86d9', 4578 + 'javelin-dom' => '3e3be199', 4579 + 'javelin-event' => '3e3be199', 4580 + 'javelin-fx' => 'adee86d9', 4581 + 'javelin-history' => '3e3be199', 4582 + 'javelin-install' => '3e3be199', 4583 + 'javelin-json' => '3e3be199', 4584 + 'javelin-mask' => '3e3be199', 4585 + 'javelin-request' => '3e3be199', 4586 + 'javelin-resource' => '3e3be199', 4587 + 'javelin-stratcom' => '3e3be199', 4588 + 'javelin-tokenizer' => '3e3be199', 4589 + 'javelin-typeahead' => '3e3be199', 4590 + 'javelin-typeahead-normalizer' => '3e3be199', 4591 + 'javelin-typeahead-ondemand-source' => '3e3be199', 4592 + 'javelin-typeahead-preloaded-source' => '3e3be199', 4593 + 'javelin-typeahead-source' => '3e3be199', 4594 + 'javelin-uri' => '3e3be199', 4595 + 'javelin-util' => '3e3be199', 4596 + 'javelin-vector' => '3e3be199', 4597 + 'javelin-workflow' => '3e3be199', 4598 4598 'lightbox-attachment-css' => '0ed58ed4', 4599 4599 'maniphest-task-summary-css' => '49898640', 4600 4600 'phabricator-action-list-view-css' => '0ed58ed4', 4601 4601 'phabricator-application-launch-view-css' => '0ed58ed4', 4602 - 'phabricator-busy' => '9eabd244', 4602 + 'phabricator-busy' => 'adee86d9', 4603 4603 'phabricator-content-source-view-css' => '4dc2311c', 4604 4604 'phabricator-core-css' => '0ed58ed4', 4605 4605 'phabricator-crumbs-view-css' => '0ed58ed4', 4606 4606 'phabricator-drag-and-drop-file-upload' => '5e9e5c4e', 4607 - 'phabricator-dropdown-menu' => '9eabd244', 4608 - 'phabricator-file-upload' => '9eabd244', 4607 + 'phabricator-dropdown-menu' => 'adee86d9', 4608 + 'phabricator-file-upload' => 'adee86d9', 4609 4609 'phabricator-filetree-view-css' => '0ed58ed4', 4610 4610 'phabricator-flag-css' => '0ed58ed4', 4611 - 'phabricator-hovercard' => '9eabd244', 4611 + 'phabricator-hovercard' => 'adee86d9', 4612 4612 'phabricator-jump-nav' => '0ed58ed4', 4613 - 'phabricator-keyboard-shortcut' => '9eabd244', 4614 - 'phabricator-keyboard-shortcut-manager' => '9eabd244', 4613 + 'phabricator-keyboard-shortcut' => 'adee86d9', 4614 + 'phabricator-keyboard-shortcut-manager' => 'adee86d9', 4615 4615 'phabricator-main-menu-view' => '0ed58ed4', 4616 - 'phabricator-menu-item' => '9eabd244', 4616 + 'phabricator-menu-item' => 'adee86d9', 4617 4617 'phabricator-nav-view-css' => '0ed58ed4', 4618 - 'phabricator-notification' => '9eabd244', 4618 + 'phabricator-notification' => 'adee86d9', 4619 4619 'phabricator-notification-css' => '0ed58ed4', 4620 4620 'phabricator-notification-menu-css' => '0ed58ed4', 4621 4621 'phabricator-object-selector-css' => '4dc2311c', 4622 - 'phabricator-phtize' => '9eabd244', 4623 - 'phabricator-prefab' => '9eabd244', 4622 + 'phabricator-phtize' => 'adee86d9', 4623 + 'phabricator-prefab' => 'adee86d9', 4624 4624 'phabricator-project-tag-css' => '49898640', 4625 4625 'phabricator-remarkup-css' => '0ed58ed4', 4626 4626 'phabricator-shaped-request' => '5e9e5c4e', 4627 4627 'phabricator-side-menu-view-css' => '0ed58ed4', 4628 4628 'phabricator-standard-page-view' => '0ed58ed4', 4629 4629 'phabricator-tag-view-css' => '0ed58ed4', 4630 - 'phabricator-textareautils' => '9eabd244', 4631 - 'phabricator-tooltip' => '9eabd244', 4630 + 'phabricator-textareautils' => 'adee86d9', 4631 + 'phabricator-tooltip' => 'adee86d9', 4632 4632 'phabricator-transaction-view-css' => '0ed58ed4', 4633 4633 'phabricator-zindex-css' => '0ed58ed4', 4634 4634 'phui-button-css' => '0ed58ed4',
+9 -1
webroot/rsrc/externals/javelin/lib/Workflow.js
··· 88 88 return; 89 89 } 90 90 91 + event.prevent(); 92 + 91 93 // Get the button (which is sometimes actually another tag, like an <a />) 92 94 // which triggered the event. In particular, this makes sure we get the 93 95 // right node if there is a <button> with an <img /> inside it or ··· 98 100 JX.Workflow._pop(); 99 101 } else { 100 102 var form = event.getNode('jx-dialog'); 103 + 104 + // Issue a DOM event first, so form-oriented handlers can act. 105 + var dom_event = JX.DOM.invoke(form, 'didWorkflowSubmit'); 106 + if (dom_event.getPrevented()) { 107 + return; 108 + } 109 + 101 110 var data = JX.DOM.convertFormToListOfPairs(form); 102 111 103 112 data.push([t.name, t.value || true]); ··· 112 121 .start(); 113 122 } 114 123 } 115 - event.prevent(); 116 124 }, 117 125 _getActiveWorkflow : function() { 118 126 var stack = JX.Workflow._stack;
+1 -1
webroot/rsrc/js/application/policy/behavior-policy-rule-editor.js
··· 42 42 43 43 JX.DOM.listen( 44 44 JX.DOM.findAbove(root, 'form'), 45 - 'submit', 45 + ['submit', 'didWorkflowSubmit'], 46 46 null, 47 47 function(e) { 48 48 var rules = JX.DOM.find(e.getNode('tag:form'), 'input', 'rules');
+1 -1
webroot/rsrc/js/core/behavior-workflow.js
··· 8 8 9 9 JX.behavior('workflow', function() { 10 10 11 - // Listen for both real 11 + // Listen for both real and synthetic submit events. 12 12 JX.Stratcom.listen( 13 13 ['submit', 'didSyntheticSubmit'], 14 14 ['workflow', 'tag:form'],