Don't show saved in OO until the ACK is received

pull/1/head
yflory 4 years ago
parent c29219c969
commit e405dcff7e

@ -99,6 +99,9 @@ define([
var sessionId = Hash.createChannelId();
var cpNfInner;
var evOnPatch = Util.mkEvent();
var evOnSync = Util.mkEvent();
// This structure is used for caching media data and blob urls for each media cryptpad url
var mediasData = {};
@ -261,13 +264,17 @@ define([
});
},
sendMsg: function (msg, cp, cb) {
evOnPatch.fire();
rtChannel.sendCmd({
cmd: 'SEND_MESSAGE',
data: {
msg: msg,
isCp: cp
}
}, cb);
}, function (err, h) {
if (!err) { evOnSync.fire(); }
cb(err, h);
});
},
};
@ -1221,6 +1228,7 @@ define([
}
},
"onDocumentReady": function () {
evOnSync.fire();
var onMigrateRdy = Util.mkEvent();
onMigrateRdy.reg(function () {
var div = h('div.cp-oo-x2tXls', [
@ -1963,6 +1971,10 @@ define([
metadataMgr: metadataMgr,
readOnly: readOnly,
realtime: info.realtime,
spinner: {
onPatch: evOnPatch,
onSync: evOnSync
},
sfCommon: common,
$container: $bar,
$contentContainer: $('#cp-app-oo-container')

@ -879,6 +879,14 @@ MessengerUI, Messages) {
$spin.text(Messages.saved);
}, /*local ? 0 :*/ SPINNER_DISAPPEAR_TIME);
};
if (config.spinner) {
var h = function () {
onSynced();
try { config.spinner.onSync.unreg(h); } catch (e) { console.error(e); }
};
config.spinner.onSync.reg(h);
return;
}
config.sfCommon.whenRealtimeSyncs(onSynced);
};
var ks = function (toolbar, config, local) {
@ -891,6 +899,15 @@ MessengerUI, Messages) {
var $spin = $('<span>', {'class': SPINNER_CLS}).appendTo(toolbar.title);
$spin.text(Messages.synchronizing);
if (config.spinner) {
config.spinner.onPatch.reg(ks(toolbar, config));
typing = 0;
setTimeout(function () {
kickSpinner(toolbar, config);
});
return $spin;
}
if (config.realtime) {
config.realtime.onPatch(ks(toolbar, config));
config.realtime.onMessage(ks(toolbar, config, true));

Loading…
Cancel
Save