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

Restore bulk edit support for remarkup fields (description, add comment)

Summary:
Depends on D18866. Ref T13025. Fixes T12415. This makes the old "Add Comment" action work, and adds support for a new "Set description to" action (possibly, I could imagine "append description" being useful some day, maybe).

The implementation is just a `<textarea />`, not a whole fancy remarkup box with `[Bold] [Italic] ...` buttons, preview, typeaheads, etc. It would be nice to enrich this eventually but doing the rendering in pure JS is currently very involved.

This requires a little bit of gymnastics to get the transaction populated properly, and adds some extra validation since we need some code there anyway.

Test Plan:
- Changed the description of a task via bulk editor.
- Added a comment to a task via bulk editor.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13025, T12415

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

+132 -11
+8 -8
resources/celerity/map.php
··· 142 142 'rsrc/css/phui/phui-basic-nav-view.css' => '98c11ab3', 143 143 'rsrc/css/phui/phui-big-info-view.css' => 'acc3492c', 144 144 'rsrc/css/phui/phui-box.css' => '4bd6cdb9', 145 - 'rsrc/css/phui/phui-bulk-editor.css' => '1fe728a8', 145 + 'rsrc/css/phui/phui-bulk-editor.css' => '9a81e5d5', 146 146 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 147 147 'rsrc/css/phui/phui-cms.css' => '504b4b23', 148 148 'rsrc/css/phui/phui-comment-form.css' => 'ac68149f', ··· 532 532 'rsrc/js/phuix/PHUIXButtonView.js' => '8a91e1ac', 533 533 'rsrc/js/phuix/PHUIXDropdownMenu.js' => '04b2ae03', 534 534 'rsrc/js/phuix/PHUIXExample.js' => '68af71ca', 535 - 'rsrc/js/phuix/PHUIXFormControl.js' => '68bb05aa', 535 + 'rsrc/js/phuix/PHUIXFormControl.js' => '1dd0870c', 536 536 'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b', 537 537 ), 538 538 'symbols' => array( ··· 822 822 'phui-basic-nav-view-css' => '98c11ab3', 823 823 'phui-big-info-view-css' => 'acc3492c', 824 824 'phui-box-css' => '4bd6cdb9', 825 - 'phui-bulk-editor-css' => '1fe728a8', 825 + 'phui-bulk-editor-css' => '9a81e5d5', 826 826 'phui-button-bar-css' => 'f1ff5494', 827 827 'phui-button-css' => '1863cc6e', 828 828 'phui-button-simple-css' => '8e1baf68', ··· 884 884 'phuix-autocomplete' => 'e0731603', 885 885 'phuix-button-view' => '8a91e1ac', 886 886 'phuix-dropdown-menu' => '04b2ae03', 887 - 'phuix-form-control-view' => '68bb05aa', 887 + 'phuix-form-control-view' => '1dd0870c', 888 888 'phuix-icon-view' => 'bff6884b', 889 889 'policy-css' => '957ea14c', 890 890 'policy-edit-css' => '815c66f7', ··· 1029 1029 'javelin-request', 1030 1030 'javelin-uri', 1031 1031 ), 1032 + '1dd0870c' => array( 1033 + 'javelin-install', 1034 + 'javelin-dom', 1035 + ), 1032 1036 '1e911d0f' => array( 1033 1037 'javelin-stratcom', 1034 1038 'javelin-request', ··· 1444 1448 'javelin-install', 1445 1449 'javelin-dom', 1446 1450 'phuix-button-view', 1447 - ), 1448 - '68bb05aa' => array( 1449 - 'javelin-install', 1450 - 'javelin-dom', 1451 1451 ), 1452 1452 '69adf288' => array( 1453 1453 'javelin-install',
+2
src/__phutil_library_map__.php
··· 223 223 'AuditQueryConduitAPIMethod' => 'applications/audit/conduit/AuditQueryConduitAPIMethod.php', 224 224 'AuthManageProvidersCapability' => 'applications/auth/capability/AuthManageProvidersCapability.php', 225 225 'BulkParameterType' => 'applications/transactions/bulk/type/BulkParameterType.php', 226 + 'BulkRemarkupParameterType' => 'applications/transactions/bulk/type/BulkRemarkupParameterType.php', 226 227 'BulkSelectParameterType' => 'applications/transactions/bulk/type/BulkSelectParameterType.php', 227 228 'BulkStringParameterType' => 'applications/transactions/bulk/type/BulkStringParameterType.php', 228 229 'CalendarTimeUtil' => 'applications/calendar/util/CalendarTimeUtil.php', ··· 5245 5246 'AuditQueryConduitAPIMethod' => 'AuditConduitAPIMethod', 5246 5247 'AuthManageProvidersCapability' => 'PhabricatorPolicyCapability', 5247 5248 'BulkParameterType' => 'Phobject', 5249 + 'BulkRemarkupParameterType' => 'BulkParameterType', 5248 5250 'BulkSelectParameterType' => 'BulkParameterType', 5249 5251 'BulkStringParameterType' => 'BulkParameterType', 5250 5252 'CalendarTimeUtil' => 'Phobject',
+1
src/applications/maniphest/editor/ManiphestEditEngine.php
··· 245 245 $fields[] = id(new PhabricatorRemarkupEditField()) 246 246 ->setKey('description') 247 247 ->setLabel(pht('Description')) 248 + ->setBulkEditLabel(pht('Set description to')) 248 249 ->setDescription(pht('Task description.')) 249 250 ->setConduitDescription(pht('Update the task description.')) 250 251 ->setConduitTypeDescription(pht('New task description.'))
+11 -2
src/applications/transactions/bulk/PhabricatorEditEngineBulkJobType.php
··· 70 70 71 71 foreach ($raw_xactions as $raw_xaction) { 72 72 $xaction = $object->getApplicationTransactionTemplate() 73 - ->setTransactionType($raw_xaction['type']) 74 - ->setNewValue($raw_xaction['value']); 73 + ->setTransactionType($raw_xaction['type']); 74 + 75 + if (isset($raw_xaction['value'])) { 76 + $xaction->setNewValue($raw_xaction['value']); 77 + } 78 + 79 + if (isset($raw_xaction['comment'])) { 80 + $comment = $xaction->getApplicationTransactionCommentObject() 81 + ->setContent($raw_xaction['comment']); 82 + $xaction->attachComment($comment); 83 + } 75 84 76 85 $xactions[] = $xaction; 77 86 }
+10
src/applications/transactions/bulk/type/BulkRemarkupParameterType.php
··· 1 + <?php 2 + 3 + final class BulkRemarkupParameterType 4 + extends BulkParameterType { 5 + 6 + public function getPHUIXControlType() { 7 + return 'remarkup'; 8 + } 9 + 10 + }
+45 -1
src/applications/transactions/editengine/PhabricatorEditEngine.php
··· 2450 2450 2451 2451 $map[] = array( 2452 2452 'label' => $bulk_label, 2453 - 'xaction' => $type->getTransactionType(), 2453 + 'xaction' => $key, 2454 2454 'control' => array( 2455 2455 'type' => $bulk_type->getPHUIXControlType(), 2456 2456 'spec' => (object)$bulk_type->getPHUIXControlSpecification(), ··· 2463 2463 2464 2464 2465 2465 final public function newRawBulkTransactions(array $xactions) { 2466 + $config = $this->loadDefaultConfiguration(); 2467 + if (!$config) { 2468 + throw new Exception( 2469 + pht('No default edit engine configuration for bulk edit.')); 2470 + } 2471 + 2472 + $object = $this->newEditableObject(); 2473 + $fields = $this->buildEditFields($object); 2474 + 2475 + $edit_types = $this->getBulkEditTypesFromFields($fields); 2476 + 2477 + foreach ($xactions as $key => $xaction) { 2478 + PhutilTypeSpec::checkMap( 2479 + $xaction, 2480 + array( 2481 + 'type' => 'string', 2482 + 'value' => 'optional wild', 2483 + 'comment' => 'optional string', 2484 + )); 2485 + 2486 + $type = $xaction['type']; 2487 + if (!isset($edit_types[$type])) { 2488 + throw new Exception( 2489 + pht( 2490 + 'Unsupported bulk edit type "%s".', 2491 + $type)); 2492 + } 2493 + 2494 + $edit_type = $edit_types[$type]; 2495 + 2496 + // Replace the edit type with the underlying transaction type. Usually 2497 + // these are 1:1 and the transaction type just has more internal noise, 2498 + // but it's possible that this isn't the case. 2499 + $xaction['type'] = $edit_type->getTransactionType(); 2500 + 2501 + $xaction = $edit_type->newRawBulkTransaction($xaction); 2502 + if ($xaction === null) { 2503 + unset($xactions[$key]); 2504 + continue; 2505 + } 2506 + 2507 + $xactions[$key] = $xaction; 2508 + } 2509 + 2466 2510 return $xactions; 2467 2511 } 2468 2512
+4
src/applications/transactions/editfield/PhabricatorRemarkupEditField.php
··· 11 11 return new ConduitStringParameterType(); 12 12 } 13 13 14 + protected function newBulkParameterType() { 15 + return new BulkRemarkupParameterType(); 16 + } 17 + 14 18 }
+15
src/applications/transactions/edittype/PhabricatorCommentEditType.php
··· 6 6 return new ConduitStringParameterType(); 7 7 } 8 8 9 + protected function newBulkParameterType() { 10 + return new BulkRemarkupParameterType(); 11 + } 12 + 13 + public function newRawBulkTransaction(array $xaction) { 14 + if (!strlen($xaction['value'])) { 15 + return null; 16 + } 17 + 18 + $xaction['comment'] = $xaction['value']; 19 + unset($xaction['value']); 20 + 21 + return $xaction; 22 + } 23 + 9 24 public function generateTransactions( 10 25 PhabricatorApplicationTransaction $template, 11 26 array $spec) {
+5
src/applications/transactions/edittype/PhabricatorEditType.php
··· 125 125 } 126 126 127 127 128 + public function newRawBulkTransaction(array $xaction) { 129 + return $xaction; 130 + } 131 + 132 + 128 133 /* -( Conduit )------------------------------------------------------------ */ 129 134 130 135
+1
src/applications/transactions/engineextension/PhabricatorCommentEditEngineExtension.php
··· 46 46 $comment_field = id(new PhabricatorCommentEditField()) 47 47 ->setKey(self::EDITKEY) 48 48 ->setLabel(pht('Comments')) 49 + ->setBulkEditLabel(pht('Add comment')) 49 50 ->setAliases(array('comments')) 50 51 ->setIsHidden(true) 51 52 ->setIsReorderable(false)
+5
webroot/rsrc/css/phui/phui-bulk-editor.css
··· 20 20 .bulk-edit-input input { 21 21 width: 100%; 22 22 } 23 + 24 + .bulk-edit-input textarea { 25 + width: 100%; 26 + height: 8em; 27 + }
+25
webroot/rsrc/js/phuix/PHUIXFormControl.js
··· 57 57 case 'text': 58 58 input = this._newText(spec); 59 59 break; 60 + case 'remarkup': 61 + input = this._newRemarkup(spec); 62 + break; 60 63 default: 61 64 // TODO: Default or better error? 62 65 JX.$E('Bad Input Type'); ··· 300 303 }; 301 304 302 305 var node = JX.$N('input', attrs); 306 + 307 + return { 308 + node: node, 309 + get: function() { 310 + return node.value; 311 + }, 312 + set: function(value) { 313 + node.value = value; 314 + } 315 + }; 316 + }, 317 + 318 + _newRemarkup: function(spec) { 319 + var attrs = {}; 320 + 321 + // We could imagine a world where this renders a full remarkup control 322 + // with all the hint buttons and client behaviors, but today much of that 323 + // behavior is defined server-side and thus this isn't a world we 324 + // currently live in. 325 + 326 + var node = JX.$N('textarea', attrs); 327 + node.value = spec.value || ''; 303 328 304 329 return { 305 330 node: node,