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

Fix some issues where Conpherence would make to many draft requests

Summary:
A few minor fixes:

- When we build a tag with `"meta" => null`, strip the attribute like we do for all other attributes. Previously, we would actually set the metadata to `null`. This happened with the Conpherence form.
- Just respond to the draft request with an empty (but valid) response, instead of building a dialog.
- `PhabricatorShapedRequest` is confusingly named and I should have caught this in review, but the basic shape of it is:
- You make one object.
- You call `trigger()` when stuff changes (e.g., a keystroke).
- It manages making a small number of requests (e.g., one request after the user stops typing for a moment).
- The way it was being used previously would incorrectly send a request for every keystroke.

I think I'm going to simplify `ShapedRequest` and merge it into some larger queue for T430.

Test Plan: Typed some text, no longer saw a flurry of requests. Reloaded page, still saw draft text.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran, chad

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

+39 -30
+15 -15
resources/celerity/map.php
··· 348 348 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '845731b8', 349 349 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 350 350 'rsrc/js/application/config/behavior-reorder-fields.js' => '938aed89', 351 - 'rsrc/js/application/conpherence/behavior-menu.js' => '7ff0b011', 351 + 'rsrc/js/application/conpherence/behavior-menu.js' => '7ee23816', 352 352 'rsrc/js/application/conpherence/behavior-pontificate.js' => '53f6f2dd', 353 353 'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'd8ef8659', 354 354 'rsrc/js/application/countdown/timer.js' => '889c96f3', ··· 535 535 'javelin-behavior-audit-preview' => 'be81801d', 536 536 'javelin-behavior-balanced-payment-form' => '3b3e1664', 537 537 'javelin-behavior-config-reorder-fields' => '938aed89', 538 - 'javelin-behavior-conpherence-menu' => '7ff0b011', 538 + 'javelin-behavior-conpherence-menu' => '7ee23816', 539 539 'javelin-behavior-conpherence-pontificate' => '53f6f2dd', 540 540 'javelin-behavior-conpherence-widget-pane' => 'd8ef8659', 541 541 'javelin-behavior-countdown-timer' => '889c96f3', ··· 1225 1225 2 => 'javelin-util', 1226 1226 3 => 'phabricator-shaped-request', 1227 1227 ), 1228 + '62e18640' => 1229 + array( 1230 + 0 => 'javelin-install', 1231 + 1 => 'javelin-util', 1232 + 2 => 'javelin-dom', 1233 + 3 => 'javelin-typeahead-normalizer', 1234 + ), 1228 1235 '6453c869' => 1229 1236 array( 1230 1237 0 => 'javelin-install', ··· 1258 1265 0 => 'javelin-behavior', 1259 1266 1 => 'javelin-dom', 1260 1267 ), 1261 - '62e18640' => 1262 - array( 1263 - 0 => 'javelin-install', 1264 - 1 => 'javelin-util', 1265 - 2 => 'javelin-dom', 1266 - 3 => 'javelin-typeahead-normalizer', 1267 - ), 1268 1268 '75903ee1' => 1269 1269 array( 1270 1270 0 => 'javelin-behavior', ··· 1313 1313 0 => 'herald-rule-editor', 1314 1314 1 => 'javelin-behavior', 1315 1315 ), 1316 - '7ee2b591' => 1317 - array( 1318 - 0 => 'javelin-behavior', 1319 - 1 => 'javelin-history', 1320 - ), 1321 - '7ff0b011' => 1316 + '7ee23816' => 1322 1317 array( 1323 1318 0 => 'javelin-behavior', 1324 1319 1 => 'javelin-dom', ··· 1329 1324 6 => 'javelin-history', 1330 1325 7 => 'javelin-vector', 1331 1326 8 => 'phabricator-shaped-request', 1327 + ), 1328 + '7ee2b591' => 1329 + array( 1330 + 0 => 'javelin-behavior', 1331 + 1 => 'javelin-history', 1332 1332 ), 1333 1333 '82947dda' => 1334 1334 array(
+1 -1
src/applications/conpherence/controller/ConpherenceUpdateController.php
··· 51 51 $conpherence->getPHID()); 52 52 $draft->setDraft($request->getStr('text')); 53 53 $draft->replaceOrDelete(); 54 - break; 54 + return new AphrontAjaxResponse(); 55 55 case ConpherenceUpdateActions::MESSAGE: 56 56 $message = $request->getStr('text'); 57 57 $xactions = $editor->generateTransactionsFromText(
+8 -4
src/infrastructure/javelin/markup.php
··· 11 11 foreach ($attributes as $k => $v) { 12 12 switch ($k) { 13 13 case 'sigil': 14 - $attributes['data-sigil'] = $v; 14 + if ($v !== null) { 15 + $attributes['data-sigil'] = $v; 16 + } 15 17 unset($attributes[$k]); 16 18 break; 17 19 case 'meta': 18 - $response = CelerityAPI::getStaticResourceResponse(); 19 - $id = $response->addMetadata($v); 20 - $attributes['data-meta'] = $id; 20 + if ($v !== null) { 21 + $response = CelerityAPI::getStaticResourceResponse(); 22 + $id = $response->addMetadata($v); 23 + $attributes['data-meta'] = $id; 24 + } 21 25 unset($attributes[$k]); 22 26 break; 23 27 case 'mustcapture':
+15 -10
webroot/rsrc/js/application/conpherence/behavior-menu.js
··· 530 530 531 531 var onkeydownDraft = function (e) { 532 532 var form = e.getNode('tag:form'); 533 - var uri = config.baseURI + 'update/' + _thread.selected + '/'; 534 - var draftRequest = new JX.PhabricatorShapedRequest( 535 - uri, 536 - JX.bag, 537 - function () { 538 - var data = JX.DOM.convertFormToDictionary(form); 539 - data.action = 'draft'; 540 - return data; 541 - }); 542 - draftRequest.start(); 533 + var data = e.getNodeData('tag:form'); 534 + 535 + if (!data.preview) { 536 + var uri = config.baseURI + 'update/' + _thread.selected + '/'; 537 + data.preview = new JX.PhabricatorShapedRequest( 538 + uri, 539 + JX.bag, 540 + function () { 541 + var data = JX.DOM.convertFormToDictionary(form); 542 + data.action = 'draft'; 543 + return data; 544 + }); 545 + } 546 + 547 + data.preview.trigger(); 543 548 }; 544 549 545 550 JX.Stratcom.listen(