mirror of
https://github.com/wekan/wekan.git
synced 2026-01-07 01:58:49 +01:00
Move every Activities.findOne() to the ReactiveCache
This commit is contained in:
parent
54f7361767
commit
79ea4d6d1e
3 changed files with 27 additions and 4 deletions
|
|
@ -43,6 +43,10 @@ ReactiveCacheServer = {
|
|||
const ret = Users.findOne(id);
|
||||
return ret;
|
||||
},
|
||||
getActivity(id) {
|
||||
const ret = Activities.findOne(id);
|
||||
return ret;
|
||||
},
|
||||
getCurrentSetting() {
|
||||
const ret = Settings.findOne();
|
||||
return ret;
|
||||
|
|
@ -157,6 +161,16 @@ ReactiveCacheClient = {
|
|||
const ret = this.__user.get(id);
|
||||
return ret;
|
||||
},
|
||||
getActivity(id) {
|
||||
if (!this.__activity) {
|
||||
this.__activity = new DataCache(_id => {
|
||||
const _ret = Activities.findOne(_id);
|
||||
return _ret;
|
||||
});
|
||||
}
|
||||
const ret = this.__activity.get(id);
|
||||
return ret;
|
||||
},
|
||||
getCurrentSetting() {
|
||||
if (!this.__currentSetting || !this.__currentSetting.get()) {
|
||||
this.__currentSetting = new DataCache(() => {
|
||||
|
|
@ -276,6 +290,15 @@ ReactiveCache = {
|
|||
}
|
||||
return ret;
|
||||
},
|
||||
getActivity(id) {
|
||||
let ret;
|
||||
if (Meteor.isServer) {
|
||||
ret = ReactiveCacheServer.getActivity(id);
|
||||
} else {
|
||||
ret = ReactiveCacheClient.getActivity(id);
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
getCurrentSetting() {
|
||||
let ret;
|
||||
if (Meteor.isServer) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue