mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Add draft support to ApplicationTransactions
Summary: When previewing, save drafts. When loading objects, restore drafts if they are available. Depends on: D665 Test Plan: - Viewed a Mock. - Typed text into the comment box. - Reloaded the page. - Text still there. - Hit submit, got my comment. - Reloaded the page. - Draft correctly deleted. - Repeated for Macros. Reviewers: btrahan, chad, vrana Reviewed By: btrahan CC: aran Maniphest Tasks: T2104 Differential Revision: https://secure.phabricator.com/D4252
This commit is contained in:
parent
0fd77783a4
commit
b116861b16
11 changed files with 243 additions and 127 deletions
2
externals/javelin
vendored
2
externals/javelin
vendored
|
@ -1 +1 @@
|
|||
Subproject commit a2672d329212c90bda4f7979400a5149f9e967d2
|
||||
Subproject commit 32c6e43f4b8b84df940bed8ed8d073e67f6c2b28
|
|
@ -709,7 +709,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'aphront-tooltip-css' =>
|
||||
array(
|
||||
'uri' => '/res/32665c0e/rsrc/css/aphront/tooltip.css',
|
||||
'uri' => '/res/79c36254/rsrc/css/aphront/tooltip.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -1199,7 +1199,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-differential-populate' =>
|
||||
array(
|
||||
'uri' => '/res/781dd9a5/rsrc/js/application/differential/behavior-populate.js',
|
||||
'uri' => '/res/769b91da/rsrc/js/application/differential/behavior-populate.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -1678,7 +1678,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-phabricator-transaction-comment-form' =>
|
||||
array(
|
||||
'uri' => '/res/bdc362ee/rsrc/js/application/transactions/behavior-transaction-comment-form.js',
|
||||
'uri' => '/res/acc3ada1/rsrc/js/application/transactions/behavior-transaction-comment-form.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -1691,7 +1691,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-phabricator-transaction-list' =>
|
||||
array(
|
||||
'uri' => '/res/212f97ba/rsrc/js/application/transactions/behavior-transaction-list.js',
|
||||
'uri' => '/res/307a71af/rsrc/js/application/transactions/behavior-transaction-list.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -1881,7 +1881,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-dom' =>
|
||||
array(
|
||||
'uri' => '/res/4c79cf8a/rsrc/js/javelin/lib/DOM.js',
|
||||
'uri' => '/res/2826c532/rsrc/js/javelin/lib/DOM.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -2063,7 +2063,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-stratcom' =>
|
||||
array(
|
||||
'uri' => '/res/3ec22c29/rsrc/js/javelin/core/Stratcom.js',
|
||||
'uri' => '/res/c81f64eb/rsrc/js/javelin/core/Stratcom.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -2869,7 +2869,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phabricator-tooltip' =>
|
||||
array(
|
||||
'uri' => '/res/bcddf5de/rsrc/js/application/core/ToolTip.js',
|
||||
'uri' => '/res/55d76b9b/rsrc/js/application/core/ToolTip.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -3214,7 +3214,7 @@ celerity_register_resource_map(array(
|
|||
), array(
|
||||
'packages' =>
|
||||
array(
|
||||
'6d338e1d' =>
|
||||
'43f32e36' =>
|
||||
array(
|
||||
'name' => 'core.pkg.css',
|
||||
'symbols' =>
|
||||
|
@ -3259,10 +3259,10 @@ celerity_register_resource_map(array(
|
|||
37 => 'phabricator-object-item-list-view-css',
|
||||
38 => 'global-drag-and-drop-css',
|
||||
),
|
||||
'uri' => '/res/pkg/6d338e1d/core.pkg.css',
|
||||
'uri' => '/res/pkg/43f32e36/core.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'70c8162b' =>
|
||||
'2921e259' =>
|
||||
array(
|
||||
'name' => 'core.pkg.js',
|
||||
'symbols' =>
|
||||
|
@ -3300,7 +3300,7 @@ celerity_register_resource_map(array(
|
|||
30 => 'phabricator-file-upload',
|
||||
31 => 'javelin-behavior-global-drag-and-drop',
|
||||
),
|
||||
'uri' => '/res/pkg/70c8162b/core.pkg.js',
|
||||
'uri' => '/res/pkg/2921e259/core.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'8edbada5' =>
|
||||
|
@ -3338,7 +3338,7 @@ celerity_register_resource_map(array(
|
|||
'uri' => '/res/pkg/380df740/differential.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'8b98837e' =>
|
||||
'76556a8f' =>
|
||||
array(
|
||||
'name' => 'differential.pkg.js',
|
||||
'symbols' =>
|
||||
|
@ -3363,7 +3363,7 @@ celerity_register_resource_map(array(
|
|||
17 => 'javelin-behavior-differential-toggle-files',
|
||||
18 => 'javelin-behavior-differential-user-select',
|
||||
),
|
||||
'uri' => '/res/pkg/8b98837e/differential.pkg.js',
|
||||
'uri' => '/res/pkg/76556a8f/differential.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'c8ce2d88' =>
|
||||
|
@ -3389,7 +3389,7 @@ celerity_register_resource_map(array(
|
|||
'uri' => '/res/pkg/5e68be89/diffusion.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'db6d724d' =>
|
||||
'fbeded59' =>
|
||||
array(
|
||||
'name' => 'javelin.pkg.js',
|
||||
'symbols' =>
|
||||
|
@ -3414,7 +3414,7 @@ celerity_register_resource_map(array(
|
|||
17 => 'javelin-typeahead-ondemand-source',
|
||||
18 => 'javelin-tokenizer',
|
||||
),
|
||||
'uri' => '/res/pkg/db6d724d/javelin.pkg.js',
|
||||
'uri' => '/res/pkg/fbeded59/javelin.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'7839ae2d' =>
|
||||
|
@ -3448,23 +3448,23 @@ celerity_register_resource_map(array(
|
|||
'reverse' =>
|
||||
array(
|
||||
'aphront-attached-file-view-css' => '7839ae2d',
|
||||
'aphront-crumbs-view-css' => '6d338e1d',
|
||||
'aphront-dialog-view-css' => '6d338e1d',
|
||||
'aphront-error-view-css' => '6d338e1d',
|
||||
'aphront-form-view-css' => '6d338e1d',
|
||||
'aphront-crumbs-view-css' => '43f32e36',
|
||||
'aphront-dialog-view-css' => '43f32e36',
|
||||
'aphront-error-view-css' => '43f32e36',
|
||||
'aphront-form-view-css' => '43f32e36',
|
||||
'aphront-headsup-action-list-view-css' => '380df740',
|
||||
'aphront-headsup-view-css' => '6d338e1d',
|
||||
'aphront-list-filter-view-css' => '6d338e1d',
|
||||
'aphront-pager-view-css' => '6d338e1d',
|
||||
'aphront-panel-view-css' => '6d338e1d',
|
||||
'aphront-side-nav-view-css' => '6d338e1d',
|
||||
'aphront-table-view-css' => '6d338e1d',
|
||||
'aphront-tokenizer-control-css' => '6d338e1d',
|
||||
'aphront-tooltip-css' => '6d338e1d',
|
||||
'aphront-typeahead-control-css' => '6d338e1d',
|
||||
'aphront-headsup-view-css' => '43f32e36',
|
||||
'aphront-list-filter-view-css' => '43f32e36',
|
||||
'aphront-pager-view-css' => '43f32e36',
|
||||
'aphront-panel-view-css' => '43f32e36',
|
||||
'aphront-side-nav-view-css' => '43f32e36',
|
||||
'aphront-table-view-css' => '43f32e36',
|
||||
'aphront-tokenizer-control-css' => '43f32e36',
|
||||
'aphront-tooltip-css' => '43f32e36',
|
||||
'aphront-typeahead-control-css' => '43f32e36',
|
||||
'differential-changeset-view-css' => '380df740',
|
||||
'differential-core-view-css' => '380df740',
|
||||
'differential-inline-comment-editor' => '8b98837e',
|
||||
'differential-inline-comment-editor' => '76556a8f',
|
||||
'differential-local-commits-view-css' => '380df740',
|
||||
'differential-results-table-css' => '380df740',
|
||||
'differential-revision-add-comment-css' => '380df740',
|
||||
|
@ -3475,117 +3475,117 @@ celerity_register_resource_map(array(
|
|||
'differential-table-of-contents-css' => '380df740',
|
||||
'diffusion-commit-view-css' => 'c8ce2d88',
|
||||
'diffusion-icons-css' => 'c8ce2d88',
|
||||
'global-drag-and-drop-css' => '6d338e1d',
|
||||
'global-drag-and-drop-css' => '43f32e36',
|
||||
'inline-comment-summary-css' => '380df740',
|
||||
'javelin-aphlict' => '70c8162b',
|
||||
'javelin-behavior' => 'db6d724d',
|
||||
'javelin-behavior-aphlict-dropdown' => '70c8162b',
|
||||
'javelin-behavior-aphlict-listen' => '70c8162b',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => '70c8162b',
|
||||
'javelin-behavior-aphront-drag-and-drop' => '8b98837e',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '8b98837e',
|
||||
'javelin-behavior-aphront-form-disable-on-submit' => '70c8162b',
|
||||
'javelin-aphlict' => '2921e259',
|
||||
'javelin-behavior' => 'fbeded59',
|
||||
'javelin-behavior-aphlict-dropdown' => '2921e259',
|
||||
'javelin-behavior-aphlict-listen' => '2921e259',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => '2921e259',
|
||||
'javelin-behavior-aphront-drag-and-drop' => '76556a8f',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '76556a8f',
|
||||
'javelin-behavior-aphront-form-disable-on-submit' => '2921e259',
|
||||
'javelin-behavior-audit-preview' => '5e68be89',
|
||||
'javelin-behavior-dark-console' => '8edbada5',
|
||||
'javelin-behavior-dark-console-ajax' => '8edbada5',
|
||||
'javelin-behavior-device' => '70c8162b',
|
||||
'javelin-behavior-differential-accept-with-errors' => '8b98837e',
|
||||
'javelin-behavior-differential-add-reviewers-and-ccs' => '8b98837e',
|
||||
'javelin-behavior-differential-comment-jump' => '8b98837e',
|
||||
'javelin-behavior-differential-diff-radios' => '8b98837e',
|
||||
'javelin-behavior-differential-dropdown-menus' => '8b98837e',
|
||||
'javelin-behavior-differential-edit-inline-comments' => '8b98837e',
|
||||
'javelin-behavior-differential-feedback-preview' => '8b98837e',
|
||||
'javelin-behavior-differential-keyboard-navigation' => '8b98837e',
|
||||
'javelin-behavior-differential-populate' => '8b98837e',
|
||||
'javelin-behavior-differential-show-more' => '8b98837e',
|
||||
'javelin-behavior-differential-toggle-files' => '8b98837e',
|
||||
'javelin-behavior-differential-user-select' => '8b98837e',
|
||||
'javelin-behavior-device' => '2921e259',
|
||||
'javelin-behavior-differential-accept-with-errors' => '76556a8f',
|
||||
'javelin-behavior-differential-add-reviewers-and-ccs' => '76556a8f',
|
||||
'javelin-behavior-differential-comment-jump' => '76556a8f',
|
||||
'javelin-behavior-differential-diff-radios' => '76556a8f',
|
||||
'javelin-behavior-differential-dropdown-menus' => '76556a8f',
|
||||
'javelin-behavior-differential-edit-inline-comments' => '76556a8f',
|
||||
'javelin-behavior-differential-feedback-preview' => '76556a8f',
|
||||
'javelin-behavior-differential-keyboard-navigation' => '76556a8f',
|
||||
'javelin-behavior-differential-populate' => '76556a8f',
|
||||
'javelin-behavior-differential-show-more' => '76556a8f',
|
||||
'javelin-behavior-differential-toggle-files' => '76556a8f',
|
||||
'javelin-behavior-differential-user-select' => '76556a8f',
|
||||
'javelin-behavior-diffusion-commit-graph' => '5e68be89',
|
||||
'javelin-behavior-diffusion-pull-lastmodified' => '5e68be89',
|
||||
'javelin-behavior-error-log' => '8edbada5',
|
||||
'javelin-behavior-global-drag-and-drop' => '70c8162b',
|
||||
'javelin-behavior-konami' => '70c8162b',
|
||||
'javelin-behavior-lightbox-attachments' => '70c8162b',
|
||||
'javelin-behavior-global-drag-and-drop' => '2921e259',
|
||||
'javelin-behavior-konami' => '2921e259',
|
||||
'javelin-behavior-lightbox-attachments' => '2921e259',
|
||||
'javelin-behavior-maniphest-batch-selector' => '7707de41',
|
||||
'javelin-behavior-maniphest-subpriority-editor' => '7707de41',
|
||||
'javelin-behavior-maniphest-transaction-controls' => '7707de41',
|
||||
'javelin-behavior-maniphest-transaction-expand' => '7707de41',
|
||||
'javelin-behavior-maniphest-transaction-preview' => '7707de41',
|
||||
'javelin-behavior-phabricator-active-nav' => '70c8162b',
|
||||
'javelin-behavior-phabricator-autofocus' => '70c8162b',
|
||||
'javelin-behavior-phabricator-keyboard-shortcuts' => '70c8162b',
|
||||
'javelin-behavior-phabricator-nav' => '70c8162b',
|
||||
'javelin-behavior-phabricator-object-selector' => '8b98837e',
|
||||
'javelin-behavior-phabricator-oncopy' => '70c8162b',
|
||||
'javelin-behavior-phabricator-remarkup-assist' => '70c8162b',
|
||||
'javelin-behavior-phabricator-search-typeahead' => '70c8162b',
|
||||
'javelin-behavior-phabricator-tooltips' => '70c8162b',
|
||||
'javelin-behavior-phabricator-watch-anchor' => '70c8162b',
|
||||
'javelin-behavior-refresh-csrf' => '70c8162b',
|
||||
'javelin-behavior-repository-crossreference' => '8b98837e',
|
||||
'javelin-behavior-toggle-class' => '70c8162b',
|
||||
'javelin-behavior-workflow' => '70c8162b',
|
||||
'javelin-dom' => 'db6d724d',
|
||||
'javelin-event' => 'db6d724d',
|
||||
'javelin-install' => 'db6d724d',
|
||||
'javelin-json' => 'db6d724d',
|
||||
'javelin-mask' => 'db6d724d',
|
||||
'javelin-request' => 'db6d724d',
|
||||
'javelin-resource' => 'db6d724d',
|
||||
'javelin-stratcom' => 'db6d724d',
|
||||
'javelin-tokenizer' => 'db6d724d',
|
||||
'javelin-typeahead' => 'db6d724d',
|
||||
'javelin-typeahead-normalizer' => 'db6d724d',
|
||||
'javelin-typeahead-ondemand-source' => 'db6d724d',
|
||||
'javelin-typeahead-preloaded-source' => 'db6d724d',
|
||||
'javelin-typeahead-source' => 'db6d724d',
|
||||
'javelin-uri' => 'db6d724d',
|
||||
'javelin-util' => 'db6d724d',
|
||||
'javelin-vector' => 'db6d724d',
|
||||
'javelin-workflow' => 'db6d724d',
|
||||
'lightbox-attachment-css' => '6d338e1d',
|
||||
'javelin-behavior-phabricator-active-nav' => '2921e259',
|
||||
'javelin-behavior-phabricator-autofocus' => '2921e259',
|
||||
'javelin-behavior-phabricator-keyboard-shortcuts' => '2921e259',
|
||||
'javelin-behavior-phabricator-nav' => '2921e259',
|
||||
'javelin-behavior-phabricator-object-selector' => '76556a8f',
|
||||
'javelin-behavior-phabricator-oncopy' => '2921e259',
|
||||
'javelin-behavior-phabricator-remarkup-assist' => '2921e259',
|
||||
'javelin-behavior-phabricator-search-typeahead' => '2921e259',
|
||||
'javelin-behavior-phabricator-tooltips' => '2921e259',
|
||||
'javelin-behavior-phabricator-watch-anchor' => '2921e259',
|
||||
'javelin-behavior-refresh-csrf' => '2921e259',
|
||||
'javelin-behavior-repository-crossreference' => '76556a8f',
|
||||
'javelin-behavior-toggle-class' => '2921e259',
|
||||
'javelin-behavior-workflow' => '2921e259',
|
||||
'javelin-dom' => 'fbeded59',
|
||||
'javelin-event' => 'fbeded59',
|
||||
'javelin-install' => 'fbeded59',
|
||||
'javelin-json' => 'fbeded59',
|
||||
'javelin-mask' => 'fbeded59',
|
||||
'javelin-request' => 'fbeded59',
|
||||
'javelin-resource' => 'fbeded59',
|
||||
'javelin-stratcom' => 'fbeded59',
|
||||
'javelin-tokenizer' => 'fbeded59',
|
||||
'javelin-typeahead' => 'fbeded59',
|
||||
'javelin-typeahead-normalizer' => 'fbeded59',
|
||||
'javelin-typeahead-ondemand-source' => 'fbeded59',
|
||||
'javelin-typeahead-preloaded-source' => 'fbeded59',
|
||||
'javelin-typeahead-source' => 'fbeded59',
|
||||
'javelin-uri' => 'fbeded59',
|
||||
'javelin-util' => 'fbeded59',
|
||||
'javelin-vector' => 'fbeded59',
|
||||
'javelin-workflow' => 'fbeded59',
|
||||
'lightbox-attachment-css' => '43f32e36',
|
||||
'maniphest-task-summary-css' => '7839ae2d',
|
||||
'maniphest-transaction-detail-css' => '7839ae2d',
|
||||
'phabricator-app-buttons-css' => '6d338e1d',
|
||||
'phabricator-busy' => '70c8162b',
|
||||
'phabricator-app-buttons-css' => '43f32e36',
|
||||
'phabricator-busy' => '2921e259',
|
||||
'phabricator-content-source-view-css' => '380df740',
|
||||
'phabricator-core-buttons-css' => '6d338e1d',
|
||||
'phabricator-core-css' => '6d338e1d',
|
||||
'phabricator-crumbs-view-css' => '6d338e1d',
|
||||
'phabricator-directory-css' => '6d338e1d',
|
||||
'phabricator-drag-and-drop-file-upload' => '8b98837e',
|
||||
'phabricator-dropdown-menu' => '70c8162b',
|
||||
'phabricator-file-upload' => '70c8162b',
|
||||
'phabricator-filetree-view-css' => '6d338e1d',
|
||||
'phabricator-flag-css' => '6d338e1d',
|
||||
'phabricator-form-view-css' => '6d338e1d',
|
||||
'phabricator-header-view-css' => '6d338e1d',
|
||||
'phabricator-jump-nav' => '6d338e1d',
|
||||
'phabricator-keyboard-shortcut' => '70c8162b',
|
||||
'phabricator-keyboard-shortcut-manager' => '70c8162b',
|
||||
'phabricator-main-menu-view' => '6d338e1d',
|
||||
'phabricator-menu-item' => '70c8162b',
|
||||
'phabricator-nav-view-css' => '6d338e1d',
|
||||
'phabricator-notification' => '70c8162b',
|
||||
'phabricator-notification-css' => '6d338e1d',
|
||||
'phabricator-notification-menu-css' => '6d338e1d',
|
||||
'phabricator-object-item-list-view-css' => '6d338e1d',
|
||||
'phabricator-core-buttons-css' => '43f32e36',
|
||||
'phabricator-core-css' => '43f32e36',
|
||||
'phabricator-crumbs-view-css' => '43f32e36',
|
||||
'phabricator-directory-css' => '43f32e36',
|
||||
'phabricator-drag-and-drop-file-upload' => '76556a8f',
|
||||
'phabricator-dropdown-menu' => '2921e259',
|
||||
'phabricator-file-upload' => '2921e259',
|
||||
'phabricator-filetree-view-css' => '43f32e36',
|
||||
'phabricator-flag-css' => '43f32e36',
|
||||
'phabricator-form-view-css' => '43f32e36',
|
||||
'phabricator-header-view-css' => '43f32e36',
|
||||
'phabricator-jump-nav' => '43f32e36',
|
||||
'phabricator-keyboard-shortcut' => '2921e259',
|
||||
'phabricator-keyboard-shortcut-manager' => '2921e259',
|
||||
'phabricator-main-menu-view' => '43f32e36',
|
||||
'phabricator-menu-item' => '2921e259',
|
||||
'phabricator-nav-view-css' => '43f32e36',
|
||||
'phabricator-notification' => '2921e259',
|
||||
'phabricator-notification-css' => '43f32e36',
|
||||
'phabricator-notification-menu-css' => '43f32e36',
|
||||
'phabricator-object-item-list-view-css' => '43f32e36',
|
||||
'phabricator-object-selector-css' => '380df740',
|
||||
'phabricator-paste-file-upload' => '70c8162b',
|
||||
'phabricator-prefab' => '70c8162b',
|
||||
'phabricator-paste-file-upload' => '2921e259',
|
||||
'phabricator-prefab' => '2921e259',
|
||||
'phabricator-project-tag-css' => '7839ae2d',
|
||||
'phabricator-remarkup-css' => '6d338e1d',
|
||||
'phabricator-shaped-request' => '8b98837e',
|
||||
'phabricator-side-menu-view-css' => '6d338e1d',
|
||||
'phabricator-standard-page-view' => '6d338e1d',
|
||||
'phabricator-textareautils' => '70c8162b',
|
||||
'phabricator-tooltip' => '70c8162b',
|
||||
'phabricator-transaction-view-css' => '6d338e1d',
|
||||
'sprite-apps-large-css' => '6d338e1d',
|
||||
'sprite-gradient-css' => '6d338e1d',
|
||||
'sprite-icon-css' => '6d338e1d',
|
||||
'sprite-menu-css' => '6d338e1d',
|
||||
'syntax-highlighting-css' => '6d338e1d',
|
||||
'phabricator-remarkup-css' => '43f32e36',
|
||||
'phabricator-shaped-request' => '76556a8f',
|
||||
'phabricator-side-menu-view-css' => '43f32e36',
|
||||
'phabricator-standard-page-view' => '43f32e36',
|
||||
'phabricator-textareautils' => '2921e259',
|
||||
'phabricator-tooltip' => '2921e259',
|
||||
'phabricator-transaction-view-css' => '43f32e36',
|
||||
'sprite-apps-large-css' => '43f32e36',
|
||||
'sprite-gradient-css' => '43f32e36',
|
||||
'sprite-icon-css' => '43f32e36',
|
||||
'sprite-menu-css' => '43f32e36',
|
||||
'syntax-highlighting-css' => '43f32e36',
|
||||
),
|
||||
));
|
||||
|
|
|
@ -353,7 +353,16 @@ final class AphrontRequest {
|
|||
* @return dict<string, string> Original request parameters.
|
||||
*/
|
||||
public function getPassthroughRequestParameters() {
|
||||
$data = self::flattenData($this->getRequestData());
|
||||
return self::flattenData($this->getPassthruRequestData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get request data other than "magic" parameters.
|
||||
*
|
||||
* @return dict<string, wild> Request data, with magic filtered out.
|
||||
*/
|
||||
public function getPassthroughRequestData() {
|
||||
$data = $this->getRequestData();
|
||||
|
||||
// Remove magic parameters like __dialog__ and __ajax__.
|
||||
foreach ($data as $key => $value) {
|
||||
|
|
|
@ -28,4 +28,53 @@ final class PhabricatorDraft extends PhabricatorDraftDAO {
|
|||
return parent::replace();
|
||||
}
|
||||
|
||||
public static function newFromUserAndKey(PhabricatorUser $user, $key) {
|
||||
if ($user->getPHID() && strlen($key)) {
|
||||
$draft = id(new PhabricatorDraft())->loadOneWhere(
|
||||
'authorPHID = %s AND draftKey = %s',
|
||||
$user->getPHID(),
|
||||
$key);
|
||||
if ($draft) {
|
||||
return $draft;
|
||||
}
|
||||
}
|
||||
|
||||
$draft = new PhabricatorDraft();
|
||||
if ($user->getPHID()) {
|
||||
$draft
|
||||
->setAuthorPHID($user->getPHID())
|
||||
->setDraftKey($key);
|
||||
}
|
||||
|
||||
return $draft;
|
||||
}
|
||||
|
||||
public static function buildFromRequest(AphrontRequest $request) {
|
||||
$user = $request->getUser();
|
||||
if (!$user->getPHID()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!$request->getStr('__draft__')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$draft = id(new PhabricatorDraft())
|
||||
->setAuthorPHID($user->getPHID())
|
||||
->setDraftKey($request->getStr('__draft__'));
|
||||
|
||||
// If this is a preview, add other data. If not, leave the draft empty so
|
||||
// that replaceOrDelete() will delete it.
|
||||
if ($request->isPreviewRequest()) {
|
||||
$other_data = $request->getPassthroughRequestData();
|
||||
unset($other_data['comment']);
|
||||
|
||||
$draft
|
||||
->setDraft($request->getStr('comment'))
|
||||
->setMetadata($other_data);
|
||||
}
|
||||
|
||||
return $draft;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ final class PhabricatorMacroCommentController
|
|||
}
|
||||
|
||||
$is_preview = $request->isPreviewRequest();
|
||||
$draft = PhabricatorDraft::buildFromRequest($request);
|
||||
|
||||
$view_uri = $this->getApplicationURI('/view/'.$macro->getID().'/');
|
||||
|
||||
|
@ -52,6 +53,10 @@ final class PhabricatorMacroCommentController
|
|||
->setException($ex);
|
||||
}
|
||||
|
||||
if ($draft) {
|
||||
$draft->replaceOrDelete();
|
||||
}
|
||||
|
||||
if ($request->isAjax()) {
|
||||
return id(new PhabricatorApplicationTransactionResponse())
|
||||
->setViewer($user)
|
||||
|
|
|
@ -83,8 +83,11 @@ final class PhabricatorMacroViewController
|
|||
? pht('Add Comment')
|
||||
: pht('Lavish Praise');
|
||||
|
||||
$draft = PhabricatorDraft::newFromUserAndKey($user, $macro->getPHID());
|
||||
|
||||
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())
|
||||
->setUser($user)
|
||||
->setDraft($draft)
|
||||
->setAction($this->getApplicationURI('/comment/'.$macro->getID().'/'))
|
||||
->setSubmitButtonName($submit_button_name);
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ final class PholioMockCommentController extends PholioController {
|
|||
|
||||
$is_preview = $request->isPreviewRequest();
|
||||
|
||||
$draft = PhabricatorDraft::buildFromRequest($request);
|
||||
|
||||
$mock_uri = '/M'.$mock->getID();
|
||||
|
||||
$comment = $request->getStr('comment');
|
||||
|
@ -61,6 +63,10 @@ final class PholioMockCommentController extends PholioController {
|
|||
->setException($ex);
|
||||
}
|
||||
|
||||
if ($draft) {
|
||||
$draft->replaceOrDelete();
|
||||
}
|
||||
|
||||
if ($request->isAjax()) {
|
||||
return id(new PhabricatorApplicationTransactionResponse())
|
||||
->setViewer($user)
|
||||
|
|
|
@ -159,6 +159,8 @@ final class PholioMockViewController extends PholioController {
|
|||
private function buildAddCommentView(PholioMock $mock) {
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$draft = PhabricatorDraft::newFromUserAndKey($user, $mock->getPHID());
|
||||
|
||||
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
|
||||
|
||||
$title = $is_serious
|
||||
|
@ -174,6 +176,7 @@ final class PholioMockViewController extends PholioController {
|
|||
|
||||
$form = id(new PhabricatorApplicationTransactionCommentView())
|
||||
->setUser($user)
|
||||
->setDraft($draft)
|
||||
->setSubmitButtonName($button_name)
|
||||
->setAction($this->getApplicationURI('/comment/'.$mock->getID().'/'));
|
||||
|
||||
|
|
|
@ -13,6 +13,17 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
|
|||
private $previewToggleID;
|
||||
private $formID;
|
||||
private $statusID;
|
||||
private $commentID;
|
||||
private $draft;
|
||||
|
||||
public function setDraft(PhabricatorDraft $draft) {
|
||||
$this->draft = $draft;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDraft() {
|
||||
return $this->draft;
|
||||
}
|
||||
|
||||
public function setSubmitButtonName($submit_button_name) {
|
||||
$this->submitButtonName = $submit_button_name;
|
||||
|
@ -47,12 +58,14 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
|
|||
'timelineID' => $this->getPreviewTimelineID(),
|
||||
'panelID' => $this->getPreviewPanelID(),
|
||||
'statusID' => $this->getStatusID(),
|
||||
'commentID' => $this->getCommentID(),
|
||||
|
||||
'loadingString' => pht('Loading Preview...'),
|
||||
'savingString' => pht('Saving Draft...'),
|
||||
'draftString' => pht('Saved Draft'),
|
||||
|
||||
'actionURI' => $this->getAction(),
|
||||
'draftKey' => $this->getDraft()->getDraftKey(),
|
||||
));
|
||||
|
||||
return self::renderSingleView(
|
||||
|
@ -70,6 +83,11 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
|
|||
),
|
||||
'');
|
||||
|
||||
$draft_comment = '';
|
||||
if ($this->getDraft()) {
|
||||
$draft_comment = $this->getDraft()->getDraft();
|
||||
}
|
||||
|
||||
return id(new AphrontFormView())
|
||||
->setUser($this->getUser())
|
||||
->setFlexible(true)
|
||||
|
@ -79,9 +97,11 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
|
|||
->setID($this->getFormID())
|
||||
->appendChild(
|
||||
id(new PhabricatorRemarkupControl())
|
||||
->setID($this->getCommentID())
|
||||
->setName('comment')
|
||||
->setLabel(pht('Comment'))
|
||||
->setUser($this->getUser()))
|
||||
->setValue($draft_comment)
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue($this->getSubmitButtonName()))
|
||||
|
@ -143,5 +163,12 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
|
|||
return $this->statusID;
|
||||
}
|
||||
|
||||
private function getCommentID() {
|
||||
if (!$this->commentID) {
|
||||
$this->commentID = celerity_generate_unique_node_id();
|
||||
}
|
||||
return $this->commentID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,19 @@ JX.behavior('phabricator-transaction-comment-form', function(config) {
|
|||
|
||||
var form = JX.$(config.formID);
|
||||
|
||||
JX.DOM.listen(form, 'willClear', null, function(e) {
|
||||
e.kill();
|
||||
JX.$(config.commentID).value = '';
|
||||
});
|
||||
|
||||
var getdata = function() {
|
||||
var obj = JX.DOM.convertFormToDictionary(form);
|
||||
obj.__preview__ = 1;
|
||||
|
||||
if (config.draftKey) {
|
||||
obj.__draft__ = config.draftKey;
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,11 @@ JX.behavior('phabricator-transaction-list', function(config) {
|
|||
JX.Workflow.newFromForm(form, {anchor: next_anchor})
|
||||
.setHandler(function(response) {
|
||||
ontransactions(response);
|
||||
form.reset();
|
||||
|
||||
var e = JX.DOM.invoke(form, 'willClear');
|
||||
if (!e.getPrevented()) {
|
||||
form.reset();
|
||||
}
|
||||
})
|
||||
.start();
|
||||
|
||||
|
|
Loading…
Reference in a new issue