mirror of
https://github.com/wekan/wekan.git
synced 2026-01-07 01:58:49 +01:00
Move every Attachments.findOne() to the ReactiveCache
This commit is contained in:
parent
fe2015735a
commit
3fc9c6efe7
5 changed files with 30 additions and 7 deletions
|
|
@ -39,6 +39,10 @@ ReactiveCacheServer = {
|
|||
const ret = CustomFields.find(selector).fetch();
|
||||
return ret;
|
||||
},
|
||||
getAttachment(id) {
|
||||
const ret = Attachments.findOne(id);
|
||||
return ret;
|
||||
},
|
||||
getUser(id) {
|
||||
const ret = Users.findOne(id);
|
||||
return ret;
|
||||
|
|
@ -159,6 +163,16 @@ ReactiveCacheClient = {
|
|||
const ret = this.__customFields.get(Jsons.stringify(selector));
|
||||
return ret;
|
||||
},
|
||||
getAttachment(id) {
|
||||
if (!this.__attachment) {
|
||||
this.__attachment = new DataCache(_id => {
|
||||
const _ret = Attachments.findOne(_id);
|
||||
return _ret;
|
||||
});
|
||||
}
|
||||
const ret = this.__attachment.get(id);
|
||||
return ret;
|
||||
},
|
||||
getUser(id) {
|
||||
if (!this.__user) {
|
||||
this.__user = new DataCache(userId => {
|
||||
|
|
@ -309,6 +323,15 @@ ReactiveCache = {
|
|||
}
|
||||
return ret;
|
||||
},
|
||||
getAttachment(id) {
|
||||
let ret;
|
||||
if (Meteor.isServer) {
|
||||
ret = ReactiveCacheServer.getAttachment(id);
|
||||
} else {
|
||||
ret = ReactiveCacheClient.getAttachment(id);
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
getUser(id) {
|
||||
let ret;
|
||||
if (Meteor.isServer) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue