Merge branch 'soon' of github.com:xwiki-labs/cryptpad into soon
commit
a4e4968b52
|
@ -31,6 +31,9 @@
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.cp-admin-setlimit-form + button {
|
||||||
|
margin-top: 5px !important;
|
||||||
|
}
|
||||||
.cp-admin-getlimits {
|
.cp-admin-getlimits {
|
||||||
code {
|
code {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
|
@ -345,7 +345,7 @@ define([
|
||||||
|
|
||||||
localStore.get('hide-alert-shareLinkWarning', function (val) {
|
localStore.get('hide-alert-shareLinkWarning', function (val) {
|
||||||
if (val === '1') { return; }
|
if (val === '1') { return; }
|
||||||
$(shareLinkWarning).show();
|
$(shareLinkWarning).css('display', 'flex');
|
||||||
|
|
||||||
$(dismissButton).on('click', function () {
|
$(dismissButton).on('click', function () {
|
||||||
localStore.put('hide-alert-shareLinkWarning', '1');
|
localStore.put('hide-alert-shareLinkWarning', '1');
|
||||||
|
|
|
@ -331,6 +331,7 @@ define([
|
||||||
if (!s.rpc) { return void cb({error: 'RPC_NOT_READY'}); }
|
if (!s.rpc) { return void cb({error: 'RPC_NOT_READY'}); }
|
||||||
|
|
||||||
s.rpc.removeOwnedChannel(channel, function (err) {
|
s.rpc.removeOwnedChannel(channel, function (err) {
|
||||||
|
if (!err) { Cache.clearChannel(channel); }
|
||||||
cb({error:err});
|
cb({error:err});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -2277,6 +2278,9 @@ define([
|
||||||
try {
|
try {
|
||||||
store.onlyoffice.leavePad(chanId);
|
store.onlyoffice.leavePad(chanId);
|
||||||
} catch (e) { console.error(e); }
|
} catch (e) { console.error(e); }
|
||||||
|
try {
|
||||||
|
Cache.leaveChannel(chanId);
|
||||||
|
} catch (e) { console.error(e); }
|
||||||
|
|
||||||
if (!Store.channels[chanId]) { return; }
|
if (!Store.channels[chanId]) { return; }
|
||||||
|
|
||||||
|
|
|
@ -91,23 +91,36 @@ define([
|
||||||
array.splice(0, firstCpIdx);
|
array.splice(0, firstCpIdx);
|
||||||
};
|
};
|
||||||
|
|
||||||
S.storeCache = function (id, validateKey, val, cb) {
|
var t = {};
|
||||||
cb = Util.once(Util.mkAsync(cb || function () {}));
|
S.storeCache = function (id, validateKey, val, onError) {
|
||||||
|
onError = Util.once(Util.mkAsync(onError || function () {}));
|
||||||
|
|
||||||
onReady.reg(function (allowed) {
|
onReady.reg(function () {
|
||||||
if (!allowed) { return void cb('NOCACHE'); }
|
|
||||||
if (!Array.isArray(val) || !validateKey) { return void cb('EINVAL'); }
|
// 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);
|
checkCheckpoints(val);
|
||||||
cache.setItem(id, {
|
cache.setItem(id, {
|
||||||
k: validateKey,
|
k: validateKey,
|
||||||
c: val,
|
c: val,
|
||||||
t: (+new Date()) // 't' represent the "lastAccess" of this cache (get or set)
|
t: (+new Date()) // 't' represent the "lastAccess" of this cache (get or set)
|
||||||
}, function (err) {
|
}, 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) {
|
S.clearChannel = function (id, cb) {
|
||||||
cb = Util.once(Util.mkAsync(cb || function () {}));
|
cb = Util.once(Util.mkAsync(cb || function () {}));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue