1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

Conpherence - improve stack re: non-update updates

Summary:
Fixes T7761. Fixes T7318.

When we send an empty message to the server, pretend its just a request to load the page. Make load a bit smarter such that if we don't get back any transactions, rather than error like the fool, just send down to the client the notion of a 'non_update'. Instrument the client to just turn off the appropriate loading state, etc for a non update.

T7318 is a tricky beast since we don't know exactly how to reproduce it but if / when it occurs again it would be some other bizarre application behavior maybe? We won't be getting the execption anymore, that's for sure.

Test Plan: removed code in `ConpherenceThreadManager.sendMessage` that protects against sending empty messages. sent empty messages (non updates) like whoa and everything worked on both durable column and main column view. re-added the code in `ConpherenceThreadManager.sendMessage` and noted empty messages did not send while any text including a space sent up nicely

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7318, T7761

Differential Revision: https://secure.phabricator.com/D12339
This commit is contained in:
Bob Trahan 2015-04-09 15:07:12 -07:00
parent 540e38d20e
commit b14ca38940
5 changed files with 93 additions and 71 deletions

View file

@ -354,9 +354,9 @@ return array(
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'bb928342',
'rsrc/js/application/conpherence/behavior-durable-column.js' => 'a0216452',
'rsrc/js/application/conpherence/behavior-menu.js' => 'db6c0ba7',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '0a5192c4',
'rsrc/js/application/conpherence/behavior-durable-column.js' => '7ffa744f',
'rsrc/js/application/conpherence/behavior-menu.js' => 'e67cfd8c',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
'rsrc/js/application/conpherence/behavior-widget-pane.js' => '1ec93bcf',
@ -519,7 +519,7 @@ return array(
'conpherence-menu-css' => '7c900089',
'conpherence-message-pane-css' => 'e44b667b',
'conpherence-notification-css' => '04a6e10a',
'conpherence-thread-manager' => 'bb928342',
'conpherence-thread-manager' => '0a5192c4',
'conpherence-update-css' => '1099a660',
'conpherence-widget-pane-css' => 'a9082fd0',
'differential-changeset-view-css' => 'e19cfd6e',
@ -559,7 +559,7 @@ return array(
'javelin-behavior-boards-dropdown' => '0ec56e1d',
'javelin-behavior-choose-control' => '6153c708',
'javelin-behavior-config-reorder-fields' => '14a827de',
'javelin-behavior-conpherence-menu' => 'db6c0ba7',
'javelin-behavior-conpherence-menu' => 'e67cfd8c',
'javelin-behavior-conpherence-pontificate' => '21ba5861',
'javelin-behavior-conpherence-widget-pane' => '1ec93bcf',
'javelin-behavior-countdown-timer' => 'e4cc26b3',
@ -586,7 +586,7 @@ return array(
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
'javelin-behavior-diffusion-pull-lastmodified' => '2b228192',
'javelin-behavior-doorkeeper-tag' => 'e5822781',
'javelin-behavior-durable-column' => 'a0216452',
'javelin-behavior-durable-column' => '7ffa744f',
'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-fancy-datepicker' => 'c51ae228',
'javelin-behavior-global-drag-and-drop' => 'bbdf75ca',
@ -874,6 +874,16 @@ return array(
'javelin-dom',
'javelin-router',
),
'0a5192c4' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'0c6946e7' => array(
'javelin-install',
'javelin-dom',
@ -1429,6 +1439,16 @@ return array(
'javelin-uri',
'phabricator-file-upload',
),
'7ffa744f' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-behavior-device',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
'conpherence-thread-manager',
),
82439934 => array(
'javelin-behavior',
'javelin-dom',
@ -1578,16 +1598,6 @@ return array(
'javelin-request',
'phabricator-shaped-request',
),
'a0216452' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-behavior-device',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
'conpherence-thread-manager',
),
'a0b57eb8' => array(
'javelin-behavior',
'javelin-dom',
@ -1681,16 +1691,6 @@ return array(
'javelin-dom',
'javelin-util',
),
'bb928342' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'bba9eedf' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1803,19 +1803,6 @@ return array(
'javelin-util',
'phabricator-shaped-request',
),
'db6c0ba7' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'javelin-behavior-device',
'javelin-history',
'javelin-vector',
'phabricator-title',
'phabricator-shaped-request',
'conpherence-thread-manager',
),
'dbbf48b6' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1901,6 +1888,19 @@ return array(
'javelin-behavior-device',
'phabricator-keyboard-shortcut',
),
'e67cfd8c' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'javelin-behavior-device',
'javelin-history',
'javelin-vector',
'phabricator-title',
'phabricator-shaped-request',
'conpherence-thread-manager',
),
'e723c323' => array(
'javelin-behavior',
'javelin-stratcom',

View file

@ -76,11 +76,17 @@ final class ConpherenceUpdateController
break;
case ConpherenceUpdateActions::MESSAGE:
$message = $request->getStr('text');
if (strlen($message)) {
$xactions = $editor->generateTransactionsFromText(
$user,
$conpherence,
$message);
$delete_draft = true;
} else {
$action = ConpherenceUpdateActions::LOAD;
$updated = false;
$response_mode = 'ajax';
}
break;
case ConpherenceUpdateActions::ADD_PERSON:
$person_phids = $request->getArr('add_person');
@ -397,13 +403,17 @@ final class ConpherenceUpdateController
->withIDs(array($conpherence_id))
->executeOne();
if ($need_transactions) {
$non_update = false;
if ($need_transactions && $conpherence->getTransactions()) {
$data = ConpherenceTransactionView::renderTransactions(
$user,
$conpherence,
!$this->getRequest()->getExists('minimal_display'));
$participant_obj = $conpherence->getParticipant($user->getPHID());
$participant_obj->markUpToDate($conpherence, $data['latest_transaction']);
} else if ($need_transactions) {
$non_update = true;
$data = array();
} else {
$data = array();
}
@ -451,6 +461,7 @@ final class ConpherenceUpdateController
}
$data = $conpherence->getDisplayData($user);
$content = array(
'non_update' => $non_update,
'transactions' => hsprintf('%s', $rendered_transactions),
'conpherence_title' => (string) $data['title'],
'latest_transaction_id' => $new_latest_transaction_id,

View file

@ -183,6 +183,11 @@ JX.install('ConpherenceThreadManager', {
_shouldUpdateDOM: function(r) {
if (this._updating &&
this._updating.threadPHID == this._loadedThreadPHID) {
if (r.non_update) {
return false;
}
// we have a different, more current update in progress so
// return early
if (r.latest_transaction_id < this._updating.knownID) {
@ -282,6 +287,11 @@ JX.install('ConpherenceThreadManager', {
},
sendMessage: function(form, params) {
// don't bother sending up text if there is nothing to submit
var textarea = JX.DOM.find(form, 'textarea');
if (!textarea.value.length) {
return;
}
params = this._getParams(params);
var keep_enabled = true;
@ -292,6 +302,8 @@ JX.install('ConpherenceThreadManager', {
this._markUpdated(r);
this._didSendMessageCallback(r);
} else if (r.non_update) {
this._didSendMessageCallback(r, true);
}
}));
this.syncWorkflow(workflow, 'finally');

View file

@ -140,7 +140,10 @@ JX.behavior('durable-column', function(config, statics) {
_focusColumnTextareaNode();
});
threadManager.setDidSendMessageCallback(function(r) {
threadManager.setDidSendMessageCallback(function(r, non_update) {
if (non_update) {
return;
}
var messages = _getColumnMessagesNode();
JX.DOM.appendContent(messages, JX.$H(r.transactions));
scrollbar.scrollTo(messages.scrollHeight);
@ -305,12 +308,6 @@ JX.behavior('durable-column', function(config, statics) {
// newline.
e.kill();
var textarea = _getColumnTextareaNode();
if (!textarea.value.length) {
// If there's no text, don't try to submit the form.
return;
}
_sendMessage(e);
});

View file

@ -57,9 +57,11 @@ JX.behavior('conpherence-menu', function(config) {
markThreadLoading(true);
JX.DOM.alterClass(form_root, 'loading', true);
});
threadManager.setDidSendMessageCallback(function (r) {
threadManager.setDidSendMessageCallback(function (r, non_update) {
var root = JX.DOM.find(document, 'div', 'conpherence-layout');
var form_root = JX.DOM.find(root, 'div', 'conpherence-form');
var textarea = JX.DOM.find(form_root, 'textarea');
if (!non_update) {
var messages_root = JX.DOM.find(root, 'div', 'conpherence-message-pane');
var messages = JX.DOM.find(messages_root, 'div', 'conpherence-messages');
var fileWidget = null;
@ -77,8 +79,8 @@ JX.behavior('conpherence-menu', function(config) {
JX.$H(r.file_widget)
);
}
var textarea = JX.DOM.find(form_root, 'textarea');
textarea.value = '';
}
markThreadLoading(false);
setTimeout(function() { JX.DOM.focus(textarea); }, 100);