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

When you "Request Review" of a draft revision, change the button text from "Submit Quietly" to "Publish Revision"

Summary:
See PHI975. Ref T13216. Ref T2543. Previously, see D19204 and PHI433.

When you're acting on a draft revision, we change the button text to "Submit Quietly" as a hint that your actions don't generate notifications yet.

However, this isn't accurate when one of your actions is "Request Review", which causes the revision to publish.

Allow actions to override the submit button text, and make the "Request Review" action change the button text to "Publish Revision".

The alternative change I considered was to remove the word "Quietly" in all cases.

I'm not //thrilled// about how complex this change is to adjust one word, but the various pieces are all fairly clean individually. I'm not sure we'll ever be able to use it for anything else, but I do suspect that the word "Quietly" was the change in D19204 with the largest effect by far (see T10000).

Test Plan:
- Created a draft revision. Saw "Submit Quietly" text.
- Added a "Request Review" action, saw it change to "Publish Revision".
- Reloaded page, saw stack saved and "Publish Revision".
- Removed action, saw "Submit Quietly".
- Repeated on a non-draft revision, button stayed put as "Submit".
- Submitted the various actions, saw them have the desired effects.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13216, T2543

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

+99 -18
+11 -11
resources/celerity/map.php
··· 422 422 'rsrc/js/application/repository/repository-crossreference.js' => '9a860428', 423 423 'rsrc/js/application/search/behavior-reorder-profile-menu-items.js' => 'e2e0a072', 424 424 'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08', 425 - 'rsrc/js/application/transactions/behavior-comment-actions.js' => '038bf27f', 425 + 'rsrc/js/application/transactions/behavior-comment-actions.js' => '59e27e74', 426 426 'rsrc/js/application/transactions/behavior-reorder-configs.js' => 'd7a74243', 427 427 'rsrc/js/application/transactions/behavior-reorder-fields.js' => 'b59e1e96', 428 428 'rsrc/js/application/transactions/behavior-show-older-transactions.js' => '8f29b364', ··· 574 574 'javelin-behavior-bulk-job-reload' => 'edf8a145', 575 575 'javelin-behavior-calendar-month-view' => 'fe33e256', 576 576 'javelin-behavior-choose-control' => '327a00d1', 577 - 'javelin-behavior-comment-actions' => '038bf27f', 577 + 'javelin-behavior-comment-actions' => '59e27e74', 578 578 'javelin-behavior-config-reorder-fields' => 'b6993408', 579 579 'javelin-behavior-conpherence-menu' => '4047cd35', 580 580 'javelin-behavior-conpherence-participant-pane' => 'd057e45a', ··· 903 903 'javelin-behavior', 904 904 'javelin-uri', 905 905 ), 906 - '038bf27f' => array( 907 - 'javelin-behavior', 908 - 'javelin-stratcom', 909 - 'javelin-workflow', 910 - 'javelin-dom', 911 - 'phuix-form-control-view', 912 - 'phuix-icon-view', 913 - 'javelin-behavior-phabricator-gesture', 914 - ), 915 906 '040fce04' => array( 916 907 'javelin-behavior', 917 908 'javelin-request', ··· 1318 1309 'javelin-stratcom', 1319 1310 'javelin-vector', 1320 1311 'javelin-dom', 1312 + ), 1313 + '59e27e74' => array( 1314 + 'javelin-behavior', 1315 + 'javelin-stratcom', 1316 + 'javelin-workflow', 1317 + 'javelin-dom', 1318 + 'phuix-form-control-view', 1319 + 'phuix-icon-view', 1320 + 'javelin-behavior-phabricator-gesture', 1321 1321 ), 1322 1322 '5c54cbf3' => array( 1323 1323 'javelin-behavior',
+8
src/applications/differential/xaction/DifferentialRevisionActionTransaction.php
··· 57 57 return null; 58 58 } 59 59 60 + protected function getRevisionActionSubmitButtonText( 61 + DifferentialRevision $revision) { 62 + return null; 63 + } 64 + 60 65 public static function loadAllActions() { 61 66 return id(new PhutilClassMapQuery()) 62 67 ->setAncestorClass(__CLASS__) ··· 109 114 110 115 $group_key = $this->getRevisionActionGroupKey(); 111 116 $field->setCommentActionGroupKey($group_key); 117 + 118 + $button_text = $this->getRevisionActionSubmitButtonText($revision); 119 + $field->setActionSubmitButtonText($button_text); 112 120 113 121 // Currently, every revision action conflicts with every other 114 122 // revision action: for example, you can not simultaneously Accept and
+13
src/applications/differential/xaction/DifferentialRevisionRequestReviewTransaction.php
··· 19 19 } 20 20 } 21 21 22 + protected function getRevisionActionSubmitButtonText( 23 + DifferentialRevision $revision) { 24 + 25 + // See PHI975. When the action stack will promote the revision out of 26 + // draft, change the button text from "Submit Quietly". 27 + if ($revision->isDraft()) { 28 + return pht('Publish Revision'); 29 + } 30 + 31 + return null; 32 + } 33 + 34 + 22 35 public function getColor() { 23 36 return 'sky'; 24 37 }
+1 -1
src/applications/owners/query/PhabricatorOwnersPackageQuery.php
··· 228 228 $repository_phid, 229 229 $indexes); 230 230 } 231 - $where[] = implode(' OR ', $clauses); 231 + $where[] = qsprintf($conn, '%LO', $clauses); 232 232 } 233 233 234 234 return $where;
+10
src/applications/transactions/commentaction/PhabricatorEditEngineCommentAction.php
··· 9 9 private $order; 10 10 private $groupKey; 11 11 private $conflictKey; 12 + private $submitButtonText; 12 13 13 14 abstract public function getPHUIXControlType(); 14 15 abstract public function getPHUIXControlSpecification(); ··· 79 80 80 81 public function getInitialValue() { 81 82 return $this->initialValue; 83 + } 84 + 85 + public function setSubmitButtonText($text) { 86 + $this->submitButtonText = $text; 87 + return $this; 88 + } 89 + 90 + public function getSubmitButtonText() { 91 + return $this->submitButtonText; 82 92 } 83 93 84 94 }
+16 -4
src/applications/transactions/editfield/PhabricatorApplyEditField.php
··· 5 5 6 6 private $actionDescription; 7 7 private $actionConflictKey; 8 + private $actionSubmitButtonText; 8 9 private $options; 9 10 10 11 protected function newControl() { ··· 27 28 28 29 public function getActionConflictKey() { 29 30 return $this->actionConflictKey; 31 + } 32 + 33 + public function setActionSubmitButtonText($text) { 34 + $this->actionSubmitButtonText = $text; 35 + return $this; 36 + } 37 + 38 + public function getActionSubmitButtonText() { 39 + return $this->actionSubmitButtonText; 30 40 } 31 41 32 42 public function setOptions(array $options) { ··· 59 69 protected function newCommentAction() { 60 70 $options = $this->getOptions(); 61 71 if ($options) { 62 - return id(new PhabricatorEditEngineCheckboxesCommentAction()) 63 - ->setConflictKey($this->getActionConflictKey()) 72 + $action = id(new PhabricatorEditEngineCheckboxesCommentAction()) 64 73 ->setOptions($options); 65 74 } else { 66 - return id(new PhabricatorEditEngineStaticCommentAction()) 67 - ->setConflictKey($this->getActionConflictKey()) 75 + $action = id(new PhabricatorEditEngineStaticCommentAction()) 68 76 ->setDescription($this->getActionDescription()); 69 77 } 78 + 79 + return $action 80 + ->setConflictKey($this->getActionConflictKey()) 81 + ->setSubmitButtonText($this->getActionSubmitButtonText()); 70 82 } 71 83 72 84 }
+3 -1
src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
··· 329 329 $key = $comment_action->getKey(); 330 330 $label = $comment_action->getLabel(); 331 331 332 - 333 332 $action_map[$key] = array( 334 333 'key' => $key, 335 334 'label' => $label, ··· 339 338 'groupKey' => $comment_action->getGroupKey(), 340 339 'conflictKey' => $comment_action->getConflictKey(), 341 340 'auralLabel' => pht('Remove Action: %s', $label), 341 + 'buttonText' => $comment_action->getSubmitButtonText(), 342 342 ); 343 343 344 344 $type_map[$key] = $comment_action; ··· 404 404 'showPreview' => $this->getShowPreview(), 405 405 'actionURI' => $this->getAction(), 406 406 'drafts' => $draft_keys, 407 + 'defaultButtonText' => $this->getSubmitButtonName(), 407 408 )); 408 409 } 409 410 ··· 426 427 id(new AphrontFormSubmitControl()) 427 428 ->addClass('phui-comment-fullwidth-control') 428 429 ->addClass('phui-comment-submit-control') 430 + ->addSigil('submit-transactions') 429 431 ->setValue($this->getSubmitButtonName())); 430 432 431 433 return $form;
+15 -1
src/view/form/control/AphrontFormSubmitControl.php
··· 3 3 final class AphrontFormSubmitControl extends AphrontFormControl { 4 4 5 5 private $buttons = array(); 6 + private $sigils = array(); 6 7 7 8 public function addCancelButton($href, $label = null) { 8 9 if (!$label) { ··· 22 23 return $this; 23 24 } 24 25 26 + public function addSigil($sigil) { 27 + $this->sigils[] = $sigil; 28 + return $this; 29 + } 30 + 25 31 protected function getCustomControlClass() { 26 32 return 'aphront-form-control-submit'; 27 33 } ··· 29 35 protected function renderInput() { 30 36 $submit_button = null; 31 37 if ($this->getValue()) { 32 - $submit_button = phutil_tag( 38 + 39 + if ($this->sigils) { 40 + $sigils = $this->sigils; 41 + } else { 42 + $sigils = null; 43 + } 44 + 45 + $submit_button = javelin_tag( 33 46 'button', 34 47 array( 35 48 'type' => 'submit', 36 49 'name' => '__submit__', 50 + 'sigil' => $sigils, 37 51 'disabled' => $this->getDisabled() ? 'disabled' : null, 38 52 ), 39 53 $this->getValue());
+22
webroot/rsrc/js/application/transactions/behavior-comment-actions.js
··· 43 43 return null; 44 44 } 45 45 46 + function redraw() { 47 + // If any of the stacked actions specify that they change the label for 48 + // the "Submit" button, update the button text. Otherwise, return it to 49 + // the default text. 50 + var button_text = config.defaultButtonText; 51 + for (var k in rows) { 52 + var action = action_map[k]; 53 + if (action.buttonText) { 54 + button_text = action.buttonText; 55 + } 56 + } 57 + 58 + var button_node = JX.DOM.find(form_node, 'button', 'submit-transactions'); 59 + JX.DOM.setContent(button_node, button_text); 60 + } 61 + 46 62 function remove_action(key) { 47 63 var row = rows[key]; 48 64 if (row) { ··· 50 66 row.option.disabled = false; 51 67 delete rows[key]; 52 68 } 69 + 70 + redraw(); 53 71 } 54 72 55 73 function serialize_actions() { ··· 90 108 91 109 control = add_row(option); 92 110 } 111 + 112 + redraw(); 93 113 } 94 114 95 115 function onresponse(response) { ··· 208 228 }); 209 229 210 230 place_node.parentNode.insertBefore(node, place_node); 231 + 232 + redraw(); 211 233 212 234 force_preview(); 213 235