mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-28 06:29:27 +01:00
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
This commit is contained in:
parent
b383d2c338
commit
e556d20577
4 changed files with 39 additions and 30 deletions
|
@ -348,7 +348,7 @@ return array(
|
||||||
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '845731b8',
|
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '845731b8',
|
||||||
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
||||||
'rsrc/js/application/config/behavior-reorder-fields.js' => '938aed89',
|
'rsrc/js/application/config/behavior-reorder-fields.js' => '938aed89',
|
||||||
'rsrc/js/application/conpherence/behavior-menu.js' => '7ff0b011',
|
'rsrc/js/application/conpherence/behavior-menu.js' => '7ee23816',
|
||||||
'rsrc/js/application/conpherence/behavior-pontificate.js' => '53f6f2dd',
|
'rsrc/js/application/conpherence/behavior-pontificate.js' => '53f6f2dd',
|
||||||
'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'd8ef8659',
|
'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'd8ef8659',
|
||||||
'rsrc/js/application/countdown/timer.js' => '889c96f3',
|
'rsrc/js/application/countdown/timer.js' => '889c96f3',
|
||||||
|
@ -535,7 +535,7 @@ return array(
|
||||||
'javelin-behavior-audit-preview' => 'be81801d',
|
'javelin-behavior-audit-preview' => 'be81801d',
|
||||||
'javelin-behavior-balanced-payment-form' => '3b3e1664',
|
'javelin-behavior-balanced-payment-form' => '3b3e1664',
|
||||||
'javelin-behavior-config-reorder-fields' => '938aed89',
|
'javelin-behavior-config-reorder-fields' => '938aed89',
|
||||||
'javelin-behavior-conpherence-menu' => '7ff0b011',
|
'javelin-behavior-conpherence-menu' => '7ee23816',
|
||||||
'javelin-behavior-conpherence-pontificate' => '53f6f2dd',
|
'javelin-behavior-conpherence-pontificate' => '53f6f2dd',
|
||||||
'javelin-behavior-conpherence-widget-pane' => 'd8ef8659',
|
'javelin-behavior-conpherence-widget-pane' => 'd8ef8659',
|
||||||
'javelin-behavior-countdown-timer' => '889c96f3',
|
'javelin-behavior-countdown-timer' => '889c96f3',
|
||||||
|
@ -1225,6 +1225,13 @@ return array(
|
||||||
2 => 'javelin-util',
|
2 => 'javelin-util',
|
||||||
3 => 'phabricator-shaped-request',
|
3 => 'phabricator-shaped-request',
|
||||||
),
|
),
|
||||||
|
'62e18640' =>
|
||||||
|
array(
|
||||||
|
0 => 'javelin-install',
|
||||||
|
1 => 'javelin-util',
|
||||||
|
2 => 'javelin-dom',
|
||||||
|
3 => 'javelin-typeahead-normalizer',
|
||||||
|
),
|
||||||
'6453c869' =>
|
'6453c869' =>
|
||||||
array(
|
array(
|
||||||
0 => 'javelin-install',
|
0 => 'javelin-install',
|
||||||
|
@ -1258,13 +1265,6 @@ return array(
|
||||||
0 => 'javelin-behavior',
|
0 => 'javelin-behavior',
|
||||||
1 => 'javelin-dom',
|
1 => 'javelin-dom',
|
||||||
),
|
),
|
||||||
'62e18640' =>
|
|
||||||
array(
|
|
||||||
0 => 'javelin-install',
|
|
||||||
1 => 'javelin-util',
|
|
||||||
2 => 'javelin-dom',
|
|
||||||
3 => 'javelin-typeahead-normalizer',
|
|
||||||
),
|
|
||||||
'75903ee1' =>
|
'75903ee1' =>
|
||||||
array(
|
array(
|
||||||
0 => 'javelin-behavior',
|
0 => 'javelin-behavior',
|
||||||
|
@ -1313,12 +1313,7 @@ return array(
|
||||||
0 => 'herald-rule-editor',
|
0 => 'herald-rule-editor',
|
||||||
1 => 'javelin-behavior',
|
1 => 'javelin-behavior',
|
||||||
),
|
),
|
||||||
'7ee2b591' =>
|
'7ee23816' =>
|
||||||
array(
|
|
||||||
0 => 'javelin-behavior',
|
|
||||||
1 => 'javelin-history',
|
|
||||||
),
|
|
||||||
'7ff0b011' =>
|
|
||||||
array(
|
array(
|
||||||
0 => 'javelin-behavior',
|
0 => 'javelin-behavior',
|
||||||
1 => 'javelin-dom',
|
1 => 'javelin-dom',
|
||||||
|
@ -1330,6 +1325,11 @@ return array(
|
||||||
7 => 'javelin-vector',
|
7 => 'javelin-vector',
|
||||||
8 => 'phabricator-shaped-request',
|
8 => 'phabricator-shaped-request',
|
||||||
),
|
),
|
||||||
|
'7ee2b591' =>
|
||||||
|
array(
|
||||||
|
0 => 'javelin-behavior',
|
||||||
|
1 => 'javelin-history',
|
||||||
|
),
|
||||||
'82947dda' =>
|
'82947dda' =>
|
||||||
array(
|
array(
|
||||||
0 => 'javelin-behavior',
|
0 => 'javelin-behavior',
|
||||||
|
|
|
@ -51,7 +51,7 @@ final class ConpherenceUpdateController
|
||||||
$conpherence->getPHID());
|
$conpherence->getPHID());
|
||||||
$draft->setDraft($request->getStr('text'));
|
$draft->setDraft($request->getStr('text'));
|
||||||
$draft->replaceOrDelete();
|
$draft->replaceOrDelete();
|
||||||
break;
|
return new AphrontAjaxResponse();
|
||||||
case ConpherenceUpdateActions::MESSAGE:
|
case ConpherenceUpdateActions::MESSAGE:
|
||||||
$message = $request->getStr('text');
|
$message = $request->getStr('text');
|
||||||
$xactions = $editor->generateTransactionsFromText(
|
$xactions = $editor->generateTransactionsFromText(
|
||||||
|
|
|
@ -11,13 +11,17 @@ function javelin_tag(
|
||||||
foreach ($attributes as $k => $v) {
|
foreach ($attributes as $k => $v) {
|
||||||
switch ($k) {
|
switch ($k) {
|
||||||
case 'sigil':
|
case 'sigil':
|
||||||
$attributes['data-sigil'] = $v;
|
if ($v !== null) {
|
||||||
|
$attributes['data-sigil'] = $v;
|
||||||
|
}
|
||||||
unset($attributes[$k]);
|
unset($attributes[$k]);
|
||||||
break;
|
break;
|
||||||
case 'meta':
|
case 'meta':
|
||||||
$response = CelerityAPI::getStaticResourceResponse();
|
if ($v !== null) {
|
||||||
$id = $response->addMetadata($v);
|
$response = CelerityAPI::getStaticResourceResponse();
|
||||||
$attributes['data-meta'] = $id;
|
$id = $response->addMetadata($v);
|
||||||
|
$attributes['data-meta'] = $id;
|
||||||
|
}
|
||||||
unset($attributes[$k]);
|
unset($attributes[$k]);
|
||||||
break;
|
break;
|
||||||
case 'mustcapture':
|
case 'mustcapture':
|
||||||
|
|
|
@ -530,16 +530,21 @@ JX.behavior('conpherence-menu', function(config) {
|
||||||
|
|
||||||
var onkeydownDraft = function (e) {
|
var onkeydownDraft = function (e) {
|
||||||
var form = e.getNode('tag:form');
|
var form = e.getNode('tag:form');
|
||||||
var uri = config.baseURI + 'update/' + _thread.selected + '/';
|
var data = e.getNodeData('tag:form');
|
||||||
var draftRequest = new JX.PhabricatorShapedRequest(
|
|
||||||
uri,
|
if (!data.preview) {
|
||||||
JX.bag,
|
var uri = config.baseURI + 'update/' + _thread.selected + '/';
|
||||||
function () {
|
data.preview = new JX.PhabricatorShapedRequest(
|
||||||
var data = JX.DOM.convertFormToDictionary(form);
|
uri,
|
||||||
data.action = 'draft';
|
JX.bag,
|
||||||
return data;
|
function () {
|
||||||
});
|
var data = JX.DOM.convertFormToDictionary(form);
|
||||||
draftRequest.start();
|
data.action = 'draft';
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
data.preview.trigger();
|
||||||
};
|
};
|
||||||
|
|
||||||
JX.Stratcom.listen(
|
JX.Stratcom.listen(
|
||||||
|
|
Loading…
Add table
Reference in a new issue