Merge branch 'soon' of github.com:xwiki-labs/cryptpad into soon

pull/1/head
ansuz 4 years ago
commit a4e4968b52

@ -31,6 +31,9 @@
margin-top: 5px;
}
}
.cp-admin-setlimit-form + button {
margin-top: 5px !important;
}
.cp-admin-getlimits {
code {
cursor: pointer;

@ -345,7 +345,7 @@ define([
localStore.get('hide-alert-shareLinkWarning', function (val) {
if (val === '1') { return; }
$(shareLinkWarning).show();
$(shareLinkWarning).css('display', 'flex');
$(dismissButton).on('click', function () {
localStore.put('hide-alert-shareLinkWarning', '1');

@ -331,6 +331,7 @@ define([
if (!s.rpc) { return void cb({error: 'RPC_NOT_READY'}); }
s.rpc.removeOwnedChannel(channel, function (err) {
if (!err) { Cache.clearChannel(channel); }
cb({error:err});
});
};
@ -2277,6 +2278,9 @@ define([
try {
store.onlyoffice.leavePad(chanId);
} catch (e) { console.error(e); }
try {
Cache.leaveChannel(chanId);
} catch (e) { console.error(e); }
if (!Store.channels[chanId]) { return; }

@ -91,23 +91,36 @@ define([
array.splice(0, firstCpIdx);
};
S.storeCache = function (id, validateKey, val, cb) {
cb = Util.once(Util.mkAsync(cb || function () {}));
var t = {};
S.storeCache = function (id, validateKey, val, onError) {
onError = Util.once(Util.mkAsync(onError || function () {}));
onReady.reg(function (allowed) {
if (!allowed) { return void cb('NOCACHE'); }
if (!Array.isArray(val) || !validateKey) { return void cb('EINVAL'); }
onReady.reg(function () {
// Make a throttle or use the existing one to avoid calling
// storeCache with the same array multiple times
t[id] = t[id] || Util.throttle(function (validateKey, val, onError) {
if (!allowed) { return void onError('NOCACHE'); }
if (!Array.isArray(val) || !validateKey) { return void onError('EINVAL'); }
checkCheckpoints(val);
cache.setItem(id, {
k: validateKey,
c: val,
t: (+new Date()) // 't' represent the "lastAccess" of this cache (get or set)
}, function (err) {
cb(err);
if (err) { onError(err); }
});
}, 50);
t[id](validateKey, val, onError);
});
};
S.leaveChannel = function (id) {
delete t[id];
};
S.clearChannel = function (id, cb) {
cb = Util.once(Util.mkAsync(cb || function () {}));

Loading…
Cancel
Save