1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-03-03 16:09:17 +01:00

Conpherence - fix some ajax bugs

Summary: the people widget was returning a comma-delimited list of HTML nodes so kill that noise with some hsprintf action. We also weren't consistently updating the latest transaction id so simplify those codepaths (widgets vs pontificate) a bit. Fixes T3336.

Test Plan: left some messages, added some participants. noted that the people widget looked good and only the pertinent transactions were pulled down on updates.

Reviewers: epriestley, chad

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3336

Differential Revision: https://secure.phabricator.com/D6180
This commit is contained in:
Bob Trahan 2013-06-11 15:07:53 -10:00
parent 6825e6ca77
commit 4c9c6fcda8
4 changed files with 18 additions and 20 deletions

View file

@ -319,6 +319,10 @@ final class ConpherenceUpdateController
break; break;
} }
$people_html = null;
if ($people_widget) {
$people_html = hsprintf('%s', $people_widget->render());
}
$content = array( $content = array(
'transactions' => hsprintf('%s', $rendered_transactions), 'transactions' => hsprintf('%s', $rendered_transactions),
'latest_transaction_id' => $new_latest_transaction_id, 'latest_transaction_id' => $new_latest_transaction_id,
@ -326,7 +330,7 @@ final class ConpherenceUpdateController
'conpherence_phid' => $conpherence->getPHID(), 'conpherence_phid' => $conpherence->getPHID(),
'header' => hsprintf('%s', $header), 'header' => hsprintf('%s', $header),
'file_widget' => $file_widget ? $file_widget->render() : null, 'file_widget' => $file_widget ? $file_widget->render() : null,
'people_widget' => $people_widget ? $people_widget->render() : null, 'people_widget' => $people_html,
); );
return $content; return $content;

View file

@ -156,10 +156,7 @@ final class ConpherenceViewController extends
'type' => 'hidden', 'type' => 'hidden',
'name' => 'latest_transaction_id', 'name' => 'latest_transaction_id',
'value' => $latest_transaction_id, 'value' => $latest_transaction_id,
'sigil' => 'latest-transaction-id', 'sigil' => 'latest-transaction-id'
'meta' => array(
'id' => $latest_transaction_id
)
), ),
'')) ''))
->render(); ->render();

View file

@ -38,13 +38,11 @@ JX.behavior('conpherence-pontificate', function(config) {
); );
} }
var inputs = JX.DOM.scry(form, 'input'); var latest_transaction_dom = JX.DOM.find(
for (var ii = 0; ii < inputs.length; ii++) { root,
if (inputs[ii].name == 'latest_transaction_id') { 'input',
inputs[ii].value = r.latest_transaction_id; 'latest-transaction-id');
break; latest_transaction_dom.value = r.latest_transaction_id;
}
}
var textarea = JX.DOM.find(form, 'textarea'); var textarea = JX.DOM.find(form, 'textarea');
textarea.value = ''; textarea.value = '';

View file

@ -258,19 +258,18 @@ JX.behavior('conpherence-widget-pane', function(config) {
} }
var root = JX.DOM.find(document, 'div', 'conpherence-layout'); var root = JX.DOM.find(document, 'div', 'conpherence-layout');
var latest_transaction_data = JX.Stratcom.getData( var latest_transaction_dom = JX.DOM.find(
JX.DOM.find(
root, root,
'input', 'input',
'latest-transaction-id' 'latest-transaction-id');
));
var data = { var data = {
latest_transaction_id : latest_transaction_data.id, latest_transaction_id : latest_transaction_dom.value,
action : create_data.action action : create_data.action
}; };
new JX.Workflow(href, data) new JX.Workflow(href, data)
.setHandler(function (r) { .setHandler(function (r) {
latest_transaction_dom.value = r.latest_transaction_id;
if (create_data.refreshFromResponse) { if (create_data.refreshFromResponse) {
var messages = null; var messages = null;
try { try {