diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 651e9dddd..8fff2e528 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -31,6 +31,9 @@ margin-top: 5px; } } + .cp-admin-setlimit-form + button { + margin-top: 5px !important; + } .cp-admin-getlimits { code { cursor: pointer; diff --git a/www/common/inner/share.js b/www/common/inner/share.js index f3ca53f75..2be698d74 100644 --- a/www/common/inner/share.js +++ b/www/common/inner/share.js @@ -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'); diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index afb799990..90318dba5 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -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; } diff --git a/www/common/outer/cache-store.js b/www/common/outer/cache-store.js index 067d2dda7..7a0a50209 100644 --- a/www/common/outer/cache-store.js +++ b/www/common/outer/cache-store.js @@ -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 () { + + // 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) { + if (err) { onError(err); } + }); + + }, 50); + t[id](validateKey, val, onError); - onReady.reg(function (allowed) { - if (!allowed) { return void cb('NOCACHE'); } - if (!Array.isArray(val) || !validateKey) { return void cb('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); - }); }); }; + S.leaveChannel = function (id) { + delete t[id]; + }; + S.clearChannel = function (id, cb) { cb = Util.once(Util.mkAsync(cb || function () {}));