@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 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

+242 -126
+124 -124
src/__celerity_resource_map__.php
··· 709 709 ), 710 710 'aphront-tooltip-css' => 711 711 array( 712 - 'uri' => '/res/32665c0e/rsrc/css/aphront/tooltip.css', 712 + 'uri' => '/res/79c36254/rsrc/css/aphront/tooltip.css', 713 713 'type' => 'css', 714 714 'requires' => 715 715 array( ··· 1199 1199 ), 1200 1200 'javelin-behavior-differential-populate' => 1201 1201 array( 1202 - 'uri' => '/res/781dd9a5/rsrc/js/application/differential/behavior-populate.js', 1202 + 'uri' => '/res/769b91da/rsrc/js/application/differential/behavior-populate.js', 1203 1203 'type' => 'js', 1204 1204 'requires' => 1205 1205 array( ··· 1678 1678 ), 1679 1679 'javelin-behavior-phabricator-transaction-comment-form' => 1680 1680 array( 1681 - 'uri' => '/res/bdc362ee/rsrc/js/application/transactions/behavior-transaction-comment-form.js', 1681 + 'uri' => '/res/acc3ada1/rsrc/js/application/transactions/behavior-transaction-comment-form.js', 1682 1682 'type' => 'js', 1683 1683 'requires' => 1684 1684 array( ··· 1691 1691 ), 1692 1692 'javelin-behavior-phabricator-transaction-list' => 1693 1693 array( 1694 - 'uri' => '/res/212f97ba/rsrc/js/application/transactions/behavior-transaction-list.js', 1694 + 'uri' => '/res/307a71af/rsrc/js/application/transactions/behavior-transaction-list.js', 1695 1695 'type' => 'js', 1696 1696 'requires' => 1697 1697 array( ··· 1881 1881 ), 1882 1882 'javelin-dom' => 1883 1883 array( 1884 - 'uri' => '/res/4c79cf8a/rsrc/js/javelin/lib/DOM.js', 1884 + 'uri' => '/res/2826c532/rsrc/js/javelin/lib/DOM.js', 1885 1885 'type' => 'js', 1886 1886 'requires' => 1887 1887 array( ··· 2063 2063 ), 2064 2064 'javelin-stratcom' => 2065 2065 array( 2066 - 'uri' => '/res/3ec22c29/rsrc/js/javelin/core/Stratcom.js', 2066 + 'uri' => '/res/c81f64eb/rsrc/js/javelin/core/Stratcom.js', 2067 2067 'type' => 'js', 2068 2068 'requires' => 2069 2069 array( ··· 2869 2869 ), 2870 2870 'phabricator-tooltip' => 2871 2871 array( 2872 - 'uri' => '/res/bcddf5de/rsrc/js/application/core/ToolTip.js', 2872 + 'uri' => '/res/55d76b9b/rsrc/js/application/core/ToolTip.js', 2873 2873 'type' => 'js', 2874 2874 'requires' => 2875 2875 array( ··· 3214 3214 ), array( 3215 3215 'packages' => 3216 3216 array( 3217 - '6d338e1d' => 3217 + '43f32e36' => 3218 3218 array( 3219 3219 'name' => 'core.pkg.css', 3220 3220 'symbols' => ··· 3259 3259 37 => 'phabricator-object-item-list-view-css', 3260 3260 38 => 'global-drag-and-drop-css', 3261 3261 ), 3262 - 'uri' => '/res/pkg/6d338e1d/core.pkg.css', 3262 + 'uri' => '/res/pkg/43f32e36/core.pkg.css', 3263 3263 'type' => 'css', 3264 3264 ), 3265 - '70c8162b' => 3265 + '2921e259' => 3266 3266 array( 3267 3267 'name' => 'core.pkg.js', 3268 3268 'symbols' => ··· 3300 3300 30 => 'phabricator-file-upload', 3301 3301 31 => 'javelin-behavior-global-drag-and-drop', 3302 3302 ), 3303 - 'uri' => '/res/pkg/70c8162b/core.pkg.js', 3303 + 'uri' => '/res/pkg/2921e259/core.pkg.js', 3304 3304 'type' => 'js', 3305 3305 ), 3306 3306 '8edbada5' => ··· 3338 3338 'uri' => '/res/pkg/380df740/differential.pkg.css', 3339 3339 'type' => 'css', 3340 3340 ), 3341 - '8b98837e' => 3341 + '76556a8f' => 3342 3342 array( 3343 3343 'name' => 'differential.pkg.js', 3344 3344 'symbols' => ··· 3363 3363 17 => 'javelin-behavior-differential-toggle-files', 3364 3364 18 => 'javelin-behavior-differential-user-select', 3365 3365 ), 3366 - 'uri' => '/res/pkg/8b98837e/differential.pkg.js', 3366 + 'uri' => '/res/pkg/76556a8f/differential.pkg.js', 3367 3367 'type' => 'js', 3368 3368 ), 3369 3369 'c8ce2d88' => ··· 3389 3389 'uri' => '/res/pkg/5e68be89/diffusion.pkg.js', 3390 3390 'type' => 'js', 3391 3391 ), 3392 - 'db6d724d' => 3392 + 'fbeded59' => 3393 3393 array( 3394 3394 'name' => 'javelin.pkg.js', 3395 3395 'symbols' => ··· 3414 3414 17 => 'javelin-typeahead-ondemand-source', 3415 3415 18 => 'javelin-tokenizer', 3416 3416 ), 3417 - 'uri' => '/res/pkg/db6d724d/javelin.pkg.js', 3417 + 'uri' => '/res/pkg/fbeded59/javelin.pkg.js', 3418 3418 'type' => 'js', 3419 3419 ), 3420 3420 '7839ae2d' => ··· 3448 3448 'reverse' => 3449 3449 array( 3450 3450 'aphront-attached-file-view-css' => '7839ae2d', 3451 - 'aphront-crumbs-view-css' => '6d338e1d', 3452 - 'aphront-dialog-view-css' => '6d338e1d', 3453 - 'aphront-error-view-css' => '6d338e1d', 3454 - 'aphront-form-view-css' => '6d338e1d', 3451 + 'aphront-crumbs-view-css' => '43f32e36', 3452 + 'aphront-dialog-view-css' => '43f32e36', 3453 + 'aphront-error-view-css' => '43f32e36', 3454 + 'aphront-form-view-css' => '43f32e36', 3455 3455 'aphront-headsup-action-list-view-css' => '380df740', 3456 - 'aphront-headsup-view-css' => '6d338e1d', 3457 - 'aphront-list-filter-view-css' => '6d338e1d', 3458 - 'aphront-pager-view-css' => '6d338e1d', 3459 - 'aphront-panel-view-css' => '6d338e1d', 3460 - 'aphront-side-nav-view-css' => '6d338e1d', 3461 - 'aphront-table-view-css' => '6d338e1d', 3462 - 'aphront-tokenizer-control-css' => '6d338e1d', 3463 - 'aphront-tooltip-css' => '6d338e1d', 3464 - 'aphront-typeahead-control-css' => '6d338e1d', 3456 + 'aphront-headsup-view-css' => '43f32e36', 3457 + 'aphront-list-filter-view-css' => '43f32e36', 3458 + 'aphront-pager-view-css' => '43f32e36', 3459 + 'aphront-panel-view-css' => '43f32e36', 3460 + 'aphront-side-nav-view-css' => '43f32e36', 3461 + 'aphront-table-view-css' => '43f32e36', 3462 + 'aphront-tokenizer-control-css' => '43f32e36', 3463 + 'aphront-tooltip-css' => '43f32e36', 3464 + 'aphront-typeahead-control-css' => '43f32e36', 3465 3465 'differential-changeset-view-css' => '380df740', 3466 3466 'differential-core-view-css' => '380df740', 3467 - 'differential-inline-comment-editor' => '8b98837e', 3467 + 'differential-inline-comment-editor' => '76556a8f', 3468 3468 'differential-local-commits-view-css' => '380df740', 3469 3469 'differential-results-table-css' => '380df740', 3470 3470 'differential-revision-add-comment-css' => '380df740', ··· 3475 3475 'differential-table-of-contents-css' => '380df740', 3476 3476 'diffusion-commit-view-css' => 'c8ce2d88', 3477 3477 'diffusion-icons-css' => 'c8ce2d88', 3478 - 'global-drag-and-drop-css' => '6d338e1d', 3478 + 'global-drag-and-drop-css' => '43f32e36', 3479 3479 'inline-comment-summary-css' => '380df740', 3480 - 'javelin-aphlict' => '70c8162b', 3481 - 'javelin-behavior' => 'db6d724d', 3482 - 'javelin-behavior-aphlict-dropdown' => '70c8162b', 3483 - 'javelin-behavior-aphlict-listen' => '70c8162b', 3484 - 'javelin-behavior-aphront-basic-tokenizer' => '70c8162b', 3485 - 'javelin-behavior-aphront-drag-and-drop' => '8b98837e', 3486 - 'javelin-behavior-aphront-drag-and-drop-textarea' => '8b98837e', 3487 - 'javelin-behavior-aphront-form-disable-on-submit' => '70c8162b', 3480 + 'javelin-aphlict' => '2921e259', 3481 + 'javelin-behavior' => 'fbeded59', 3482 + 'javelin-behavior-aphlict-dropdown' => '2921e259', 3483 + 'javelin-behavior-aphlict-listen' => '2921e259', 3484 + 'javelin-behavior-aphront-basic-tokenizer' => '2921e259', 3485 + 'javelin-behavior-aphront-drag-and-drop' => '76556a8f', 3486 + 'javelin-behavior-aphront-drag-and-drop-textarea' => '76556a8f', 3487 + 'javelin-behavior-aphront-form-disable-on-submit' => '2921e259', 3488 3488 'javelin-behavior-audit-preview' => '5e68be89', 3489 3489 'javelin-behavior-dark-console' => '8edbada5', 3490 3490 'javelin-behavior-dark-console-ajax' => '8edbada5', 3491 - 'javelin-behavior-device' => '70c8162b', 3492 - 'javelin-behavior-differential-accept-with-errors' => '8b98837e', 3493 - 'javelin-behavior-differential-add-reviewers-and-ccs' => '8b98837e', 3494 - 'javelin-behavior-differential-comment-jump' => '8b98837e', 3495 - 'javelin-behavior-differential-diff-radios' => '8b98837e', 3496 - 'javelin-behavior-differential-dropdown-menus' => '8b98837e', 3497 - 'javelin-behavior-differential-edit-inline-comments' => '8b98837e', 3498 - 'javelin-behavior-differential-feedback-preview' => '8b98837e', 3499 - 'javelin-behavior-differential-keyboard-navigation' => '8b98837e', 3500 - 'javelin-behavior-differential-populate' => '8b98837e', 3501 - 'javelin-behavior-differential-show-more' => '8b98837e', 3502 - 'javelin-behavior-differential-toggle-files' => '8b98837e', 3503 - 'javelin-behavior-differential-user-select' => '8b98837e', 3491 + 'javelin-behavior-device' => '2921e259', 3492 + 'javelin-behavior-differential-accept-with-errors' => '76556a8f', 3493 + 'javelin-behavior-differential-add-reviewers-and-ccs' => '76556a8f', 3494 + 'javelin-behavior-differential-comment-jump' => '76556a8f', 3495 + 'javelin-behavior-differential-diff-radios' => '76556a8f', 3496 + 'javelin-behavior-differential-dropdown-menus' => '76556a8f', 3497 + 'javelin-behavior-differential-edit-inline-comments' => '76556a8f', 3498 + 'javelin-behavior-differential-feedback-preview' => '76556a8f', 3499 + 'javelin-behavior-differential-keyboard-navigation' => '76556a8f', 3500 + 'javelin-behavior-differential-populate' => '76556a8f', 3501 + 'javelin-behavior-differential-show-more' => '76556a8f', 3502 + 'javelin-behavior-differential-toggle-files' => '76556a8f', 3503 + 'javelin-behavior-differential-user-select' => '76556a8f', 3504 3504 'javelin-behavior-diffusion-commit-graph' => '5e68be89', 3505 3505 'javelin-behavior-diffusion-pull-lastmodified' => '5e68be89', 3506 3506 'javelin-behavior-error-log' => '8edbada5', 3507 - 'javelin-behavior-global-drag-and-drop' => '70c8162b', 3508 - 'javelin-behavior-konami' => '70c8162b', 3509 - 'javelin-behavior-lightbox-attachments' => '70c8162b', 3507 + 'javelin-behavior-global-drag-and-drop' => '2921e259', 3508 + 'javelin-behavior-konami' => '2921e259', 3509 + 'javelin-behavior-lightbox-attachments' => '2921e259', 3510 3510 'javelin-behavior-maniphest-batch-selector' => '7707de41', 3511 3511 'javelin-behavior-maniphest-subpriority-editor' => '7707de41', 3512 3512 'javelin-behavior-maniphest-transaction-controls' => '7707de41', 3513 3513 'javelin-behavior-maniphest-transaction-expand' => '7707de41', 3514 3514 'javelin-behavior-maniphest-transaction-preview' => '7707de41', 3515 - 'javelin-behavior-phabricator-active-nav' => '70c8162b', 3516 - 'javelin-behavior-phabricator-autofocus' => '70c8162b', 3517 - 'javelin-behavior-phabricator-keyboard-shortcuts' => '70c8162b', 3518 - 'javelin-behavior-phabricator-nav' => '70c8162b', 3519 - 'javelin-behavior-phabricator-object-selector' => '8b98837e', 3520 - 'javelin-behavior-phabricator-oncopy' => '70c8162b', 3521 - 'javelin-behavior-phabricator-remarkup-assist' => '70c8162b', 3522 - 'javelin-behavior-phabricator-search-typeahead' => '70c8162b', 3523 - 'javelin-behavior-phabricator-tooltips' => '70c8162b', 3524 - 'javelin-behavior-phabricator-watch-anchor' => '70c8162b', 3525 - 'javelin-behavior-refresh-csrf' => '70c8162b', 3526 - 'javelin-behavior-repository-crossreference' => '8b98837e', 3527 - 'javelin-behavior-toggle-class' => '70c8162b', 3528 - 'javelin-behavior-workflow' => '70c8162b', 3529 - 'javelin-dom' => 'db6d724d', 3530 - 'javelin-event' => 'db6d724d', 3531 - 'javelin-install' => 'db6d724d', 3532 - 'javelin-json' => 'db6d724d', 3533 - 'javelin-mask' => 'db6d724d', 3534 - 'javelin-request' => 'db6d724d', 3535 - 'javelin-resource' => 'db6d724d', 3536 - 'javelin-stratcom' => 'db6d724d', 3537 - 'javelin-tokenizer' => 'db6d724d', 3538 - 'javelin-typeahead' => 'db6d724d', 3539 - 'javelin-typeahead-normalizer' => 'db6d724d', 3540 - 'javelin-typeahead-ondemand-source' => 'db6d724d', 3541 - 'javelin-typeahead-preloaded-source' => 'db6d724d', 3542 - 'javelin-typeahead-source' => 'db6d724d', 3543 - 'javelin-uri' => 'db6d724d', 3544 - 'javelin-util' => 'db6d724d', 3545 - 'javelin-vector' => 'db6d724d', 3546 - 'javelin-workflow' => 'db6d724d', 3547 - 'lightbox-attachment-css' => '6d338e1d', 3515 + 'javelin-behavior-phabricator-active-nav' => '2921e259', 3516 + 'javelin-behavior-phabricator-autofocus' => '2921e259', 3517 + 'javelin-behavior-phabricator-keyboard-shortcuts' => '2921e259', 3518 + 'javelin-behavior-phabricator-nav' => '2921e259', 3519 + 'javelin-behavior-phabricator-object-selector' => '76556a8f', 3520 + 'javelin-behavior-phabricator-oncopy' => '2921e259', 3521 + 'javelin-behavior-phabricator-remarkup-assist' => '2921e259', 3522 + 'javelin-behavior-phabricator-search-typeahead' => '2921e259', 3523 + 'javelin-behavior-phabricator-tooltips' => '2921e259', 3524 + 'javelin-behavior-phabricator-watch-anchor' => '2921e259', 3525 + 'javelin-behavior-refresh-csrf' => '2921e259', 3526 + 'javelin-behavior-repository-crossreference' => '76556a8f', 3527 + 'javelin-behavior-toggle-class' => '2921e259', 3528 + 'javelin-behavior-workflow' => '2921e259', 3529 + 'javelin-dom' => 'fbeded59', 3530 + 'javelin-event' => 'fbeded59', 3531 + 'javelin-install' => 'fbeded59', 3532 + 'javelin-json' => 'fbeded59', 3533 + 'javelin-mask' => 'fbeded59', 3534 + 'javelin-request' => 'fbeded59', 3535 + 'javelin-resource' => 'fbeded59', 3536 + 'javelin-stratcom' => 'fbeded59', 3537 + 'javelin-tokenizer' => 'fbeded59', 3538 + 'javelin-typeahead' => 'fbeded59', 3539 + 'javelin-typeahead-normalizer' => 'fbeded59', 3540 + 'javelin-typeahead-ondemand-source' => 'fbeded59', 3541 + 'javelin-typeahead-preloaded-source' => 'fbeded59', 3542 + 'javelin-typeahead-source' => 'fbeded59', 3543 + 'javelin-uri' => 'fbeded59', 3544 + 'javelin-util' => 'fbeded59', 3545 + 'javelin-vector' => 'fbeded59', 3546 + 'javelin-workflow' => 'fbeded59', 3547 + 'lightbox-attachment-css' => '43f32e36', 3548 3548 'maniphest-task-summary-css' => '7839ae2d', 3549 3549 'maniphest-transaction-detail-css' => '7839ae2d', 3550 - 'phabricator-app-buttons-css' => '6d338e1d', 3551 - 'phabricator-busy' => '70c8162b', 3550 + 'phabricator-app-buttons-css' => '43f32e36', 3551 + 'phabricator-busy' => '2921e259', 3552 3552 'phabricator-content-source-view-css' => '380df740', 3553 - 'phabricator-core-buttons-css' => '6d338e1d', 3554 - 'phabricator-core-css' => '6d338e1d', 3555 - 'phabricator-crumbs-view-css' => '6d338e1d', 3556 - 'phabricator-directory-css' => '6d338e1d', 3557 - 'phabricator-drag-and-drop-file-upload' => '8b98837e', 3558 - 'phabricator-dropdown-menu' => '70c8162b', 3559 - 'phabricator-file-upload' => '70c8162b', 3560 - 'phabricator-filetree-view-css' => '6d338e1d', 3561 - 'phabricator-flag-css' => '6d338e1d', 3562 - 'phabricator-form-view-css' => '6d338e1d', 3563 - 'phabricator-header-view-css' => '6d338e1d', 3564 - 'phabricator-jump-nav' => '6d338e1d', 3565 - 'phabricator-keyboard-shortcut' => '70c8162b', 3566 - 'phabricator-keyboard-shortcut-manager' => '70c8162b', 3567 - 'phabricator-main-menu-view' => '6d338e1d', 3568 - 'phabricator-menu-item' => '70c8162b', 3569 - 'phabricator-nav-view-css' => '6d338e1d', 3570 - 'phabricator-notification' => '70c8162b', 3571 - 'phabricator-notification-css' => '6d338e1d', 3572 - 'phabricator-notification-menu-css' => '6d338e1d', 3573 - 'phabricator-object-item-list-view-css' => '6d338e1d', 3553 + 'phabricator-core-buttons-css' => '43f32e36', 3554 + 'phabricator-core-css' => '43f32e36', 3555 + 'phabricator-crumbs-view-css' => '43f32e36', 3556 + 'phabricator-directory-css' => '43f32e36', 3557 + 'phabricator-drag-and-drop-file-upload' => '76556a8f', 3558 + 'phabricator-dropdown-menu' => '2921e259', 3559 + 'phabricator-file-upload' => '2921e259', 3560 + 'phabricator-filetree-view-css' => '43f32e36', 3561 + 'phabricator-flag-css' => '43f32e36', 3562 + 'phabricator-form-view-css' => '43f32e36', 3563 + 'phabricator-header-view-css' => '43f32e36', 3564 + 'phabricator-jump-nav' => '43f32e36', 3565 + 'phabricator-keyboard-shortcut' => '2921e259', 3566 + 'phabricator-keyboard-shortcut-manager' => '2921e259', 3567 + 'phabricator-main-menu-view' => '43f32e36', 3568 + 'phabricator-menu-item' => '2921e259', 3569 + 'phabricator-nav-view-css' => '43f32e36', 3570 + 'phabricator-notification' => '2921e259', 3571 + 'phabricator-notification-css' => '43f32e36', 3572 + 'phabricator-notification-menu-css' => '43f32e36', 3573 + 'phabricator-object-item-list-view-css' => '43f32e36', 3574 3574 'phabricator-object-selector-css' => '380df740', 3575 - 'phabricator-paste-file-upload' => '70c8162b', 3576 - 'phabricator-prefab' => '70c8162b', 3575 + 'phabricator-paste-file-upload' => '2921e259', 3576 + 'phabricator-prefab' => '2921e259', 3577 3577 'phabricator-project-tag-css' => '7839ae2d', 3578 - 'phabricator-remarkup-css' => '6d338e1d', 3579 - 'phabricator-shaped-request' => '8b98837e', 3580 - 'phabricator-side-menu-view-css' => '6d338e1d', 3581 - 'phabricator-standard-page-view' => '6d338e1d', 3582 - 'phabricator-textareautils' => '70c8162b', 3583 - 'phabricator-tooltip' => '70c8162b', 3584 - 'phabricator-transaction-view-css' => '6d338e1d', 3585 - 'sprite-apps-large-css' => '6d338e1d', 3586 - 'sprite-gradient-css' => '6d338e1d', 3587 - 'sprite-icon-css' => '6d338e1d', 3588 - 'sprite-menu-css' => '6d338e1d', 3589 - 'syntax-highlighting-css' => '6d338e1d', 3578 + 'phabricator-remarkup-css' => '43f32e36', 3579 + 'phabricator-shaped-request' => '76556a8f', 3580 + 'phabricator-side-menu-view-css' => '43f32e36', 3581 + 'phabricator-standard-page-view' => '43f32e36', 3582 + 'phabricator-textareautils' => '2921e259', 3583 + 'phabricator-tooltip' => '2921e259', 3584 + 'phabricator-transaction-view-css' => '43f32e36', 3585 + 'sprite-apps-large-css' => '43f32e36', 3586 + 'sprite-gradient-css' => '43f32e36', 3587 + 'sprite-icon-css' => '43f32e36', 3588 + 'sprite-menu-css' => '43f32e36', 3589 + 'syntax-highlighting-css' => '43f32e36', 3590 3590 ), 3591 3591 ));
+10 -1
src/aphront/AphrontRequest.php
··· 353 353 * @return dict<string, string> Original request parameters. 354 354 */ 355 355 public function getPassthroughRequestParameters() { 356 - $data = self::flattenData($this->getRequestData()); 356 + return self::flattenData($this->getPassthruRequestData()); 357 + } 358 + 359 + /** 360 + * Get request data other than "magic" parameters. 361 + * 362 + * @return dict<string, wild> Request data, with magic filtered out. 363 + */ 364 + public function getPassthroughRequestData() { 365 + $data = $this->getRequestData(); 357 366 358 367 // Remove magic parameters like __dialog__ and __ajax__. 359 368 foreach ($data as $key => $value) {
+49
src/applications/draft/storage/PhabricatorDraft.php
··· 28 28 return parent::replace(); 29 29 } 30 30 31 + public static function newFromUserAndKey(PhabricatorUser $user, $key) { 32 + if ($user->getPHID() && strlen($key)) { 33 + $draft = id(new PhabricatorDraft())->loadOneWhere( 34 + 'authorPHID = %s AND draftKey = %s', 35 + $user->getPHID(), 36 + $key); 37 + if ($draft) { 38 + return $draft; 39 + } 40 + } 41 + 42 + $draft = new PhabricatorDraft(); 43 + if ($user->getPHID()) { 44 + $draft 45 + ->setAuthorPHID($user->getPHID()) 46 + ->setDraftKey($key); 47 + } 48 + 49 + return $draft; 50 + } 51 + 52 + public static function buildFromRequest(AphrontRequest $request) { 53 + $user = $request->getUser(); 54 + if (!$user->getPHID()) { 55 + return null; 56 + } 57 + 58 + if (!$request->getStr('__draft__')) { 59 + return null; 60 + } 61 + 62 + $draft = id(new PhabricatorDraft()) 63 + ->setAuthorPHID($user->getPHID()) 64 + ->setDraftKey($request->getStr('__draft__')); 65 + 66 + // If this is a preview, add other data. If not, leave the draft empty so 67 + // that replaceOrDelete() will delete it. 68 + if ($request->isPreviewRequest()) { 69 + $other_data = $request->getPassthroughRequestData(); 70 + unset($other_data['comment']); 71 + 72 + $draft 73 + ->setDraft($request->getStr('comment')) 74 + ->setMetadata($other_data); 75 + } 76 + 77 + return $draft; 78 + } 79 + 31 80 }
+5
src/applications/macro/controller/PhabricatorMacroCommentController.php
··· 23 23 } 24 24 25 25 $is_preview = $request->isPreviewRequest(); 26 + $draft = PhabricatorDraft::buildFromRequest($request); 26 27 27 28 $view_uri = $this->getApplicationURI('/view/'.$macro->getID().'/'); 28 29 ··· 50 51 return id(new PhabricatorApplicationTransactionNoEffectResponse()) 51 52 ->setCancelURI($view_uri) 52 53 ->setException($ex); 54 + } 55 + 56 + if ($draft) { 57 + $draft->replaceOrDelete(); 53 58 } 54 59 55 60 if ($request->isAjax()) {
+3
src/applications/macro/controller/PhabricatorMacroViewController.php
··· 83 83 ? pht('Add Comment') 84 84 : pht('Lavish Praise'); 85 85 86 + $draft = PhabricatorDraft::newFromUserAndKey($user, $macro->getPHID()); 87 + 86 88 $add_comment_form = id(new PhabricatorApplicationTransactionCommentView()) 87 89 ->setUser($user) 90 + ->setDraft($draft) 88 91 ->setAction($this->getApplicationURI('/comment/'.$macro->getID().'/')) 89 92 ->setSubmitButtonName($submit_button_name); 90 93
+6
src/applications/pholio/controller/PholioMockCommentController.php
··· 30 30 31 31 $is_preview = $request->isPreviewRequest(); 32 32 33 + $draft = PhabricatorDraft::buildFromRequest($request); 34 + 33 35 $mock_uri = '/M'.$mock->getID(); 34 36 35 37 $comment = $request->getStr('comment'); ··· 59 61 return id(new PhabricatorApplicationTransactionNoEffectResponse()) 60 62 ->setCancelURI($mock_uri) 61 63 ->setException($ex); 64 + } 65 + 66 + if ($draft) { 67 + $draft->replaceOrDelete(); 62 68 } 63 69 64 70 if ($request->isAjax()) {
+3
src/applications/pholio/controller/PholioMockViewController.php
··· 159 159 private function buildAddCommentView(PholioMock $mock) { 160 160 $user = $this->getRequest()->getUser(); 161 161 162 + $draft = PhabricatorDraft::newFromUserAndKey($user, $mock->getPHID()); 163 + 162 164 $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); 163 165 164 166 $title = $is_serious ··· 174 176 175 177 $form = id(new PhabricatorApplicationTransactionCommentView()) 176 178 ->setUser($user) 179 + ->setDraft($draft) 177 180 ->setSubmitButtonName($button_name) 178 181 ->setAction($this->getApplicationURI('/comment/'.$mock->getID().'/')); 179 182
+27
src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
··· 13 13 private $previewToggleID; 14 14 private $formID; 15 15 private $statusID; 16 + private $commentID; 17 + private $draft; 18 + 19 + public function setDraft(PhabricatorDraft $draft) { 20 + $this->draft = $draft; 21 + return $this; 22 + } 23 + 24 + public function getDraft() { 25 + return $this->draft; 26 + } 16 27 17 28 public function setSubmitButtonName($submit_button_name) { 18 29 $this->submitButtonName = $submit_button_name; ··· 47 58 'timelineID' => $this->getPreviewTimelineID(), 48 59 'panelID' => $this->getPreviewPanelID(), 49 60 'statusID' => $this->getStatusID(), 61 + 'commentID' => $this->getCommentID(), 50 62 51 63 'loadingString' => pht('Loading Preview...'), 52 64 'savingString' => pht('Saving Draft...'), 53 65 'draftString' => pht('Saved Draft'), 54 66 55 67 'actionURI' => $this->getAction(), 68 + 'draftKey' => $this->getDraft()->getDraftKey(), 56 69 )); 57 70 58 71 return self::renderSingleView( ··· 70 83 ), 71 84 ''); 72 85 86 + $draft_comment = ''; 87 + if ($this->getDraft()) { 88 + $draft_comment = $this->getDraft()->getDraft(); 89 + } 90 + 73 91 return id(new AphrontFormView()) 74 92 ->setUser($this->getUser()) 75 93 ->setFlexible(true) ··· 79 97 ->setID($this->getFormID()) 80 98 ->appendChild( 81 99 id(new PhabricatorRemarkupControl()) 100 + ->setID($this->getCommentID()) 82 101 ->setName('comment') 83 102 ->setLabel(pht('Comment')) 84 103 ->setUser($this->getUser())) 104 + ->setValue($draft_comment) 85 105 ->appendChild( 86 106 id(new AphrontFormSubmitControl()) 87 107 ->setValue($this->getSubmitButtonName())) ··· 141 161 $this->statusID = celerity_generate_unique_node_id(); 142 162 } 143 163 return $this->statusID; 164 + } 165 + 166 + private function getCommentID() { 167 + if (!$this->commentID) { 168 + $this->commentID = celerity_generate_unique_node_id(); 169 + } 170 + return $this->commentID; 144 171 } 145 172 146 173 }
+10
webroot/rsrc/js/application/transactions/behavior-transaction-comment-form.js
··· 10 10 11 11 var form = JX.$(config.formID); 12 12 13 + JX.DOM.listen(form, 'willClear', null, function(e) { 14 + e.kill(); 15 + JX.$(config.commentID).value = ''; 16 + }); 17 + 13 18 var getdata = function() { 14 19 var obj = JX.DOM.convertFormToDictionary(form); 15 20 obj.__preview__ = 1; 21 + 22 + if (config.draftKey) { 23 + obj.__draft__ = config.draftKey; 24 + } 25 + 16 26 return obj; 17 27 }; 18 28
+5 -1
webroot/rsrc/js/application/transactions/behavior-transaction-list.js
··· 81 81 JX.Workflow.newFromForm(form, {anchor: next_anchor}) 82 82 .setHandler(function(response) { 83 83 ontransactions(response); 84 - form.reset(); 84 + 85 + var e = JX.DOM.invoke(form, 'willClear'); 86 + if (!e.getPrevented()) { 87 + form.reset(); 88 + } 85 89 }) 86 90 .start(); 87 91