Disable cache and fix settings load

pull/3483/merge
Rodrigo Nascimento 9 years ago
parent b372b789d4
commit e3ae26c2ce
No known key found for this signature in database
GPG Key ID: 2C85B3AFE75D23F9
  1. 6
      packages/rocketchat-lib/client/lib/cachedCollection.js
  2. 2
      packages/rocketchat-lib/package.js
  3. 2
      packages/rocketchat-lib/server/publications/settings.coffee

@ -8,6 +8,7 @@ class CachedCollection {
eventName,
eventType = 'onUser',
sync = true,
useCache = false,
debug = true
}) {
this.collection = collection || new Meteor.Collection(null);
@ -18,6 +19,7 @@ class CachedCollection {
this.eventName = eventName || name;
this.eventType = eventType;
this.sync = sync;
this.useCache = useCache;
this.debug = debug;
}
@ -28,6 +30,10 @@ class CachedCollection {
}
loadFromCache(callback = () => {}) {
if (this.useCache === false) {
return callback(false);
}
localforage.getItem(this.name, (error, data) => {
if (data && data.records) {
this.log(`CachedCollection ${this.name} => ${data.records.length} records loaded from cache`);

@ -115,6 +115,7 @@ Package.onUse(function(api) {
api.addFiles('lib/startup/settingsOnLoadSiteUrl.coffee');
// CLIENT LIB
api.addFiles('client/Notifications.coffee', 'client');
api.addFiles('client/lib/localforage.min.js', 'client');
api.addFiles('client/lib/cachedCollection.js', 'client');
api.addFiles('client/lib/openRoom.coffee', 'client');
@ -126,7 +127,6 @@ Package.onUse(function(api) {
// CLIENT METHODS
api.addFiles('client/methods/sendMessage.coffee', 'client');
api.addFiles('client/AdminBox.coffee', 'client');
api.addFiles('client/Notifications.coffee', 'client');
api.addFiles('client/TabBar.coffee', 'client');
api.addFiles('client/MessageAction.coffee', 'client');

@ -13,7 +13,7 @@ Meteor.methods
if not RocketChat.authz.hasPermission Meteor.userId(), 'view-privileged-setting'
return []
return RocketChat.models.Settings.findNotHiddenPrivate().fetch()
return RocketChat.models.Settings.findNotHidden().fetch()
subscriptionsReady = false

Loading…
Cancel
Save