mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Move every Attachments.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory server/)
This commit is contained in:
parent
d6ca13a61d
commit
e53b63541e
3 changed files with 14 additions and 9 deletions
|
@ -2,7 +2,7 @@ import Attachments from '/models/attachments';
|
|||
import { ObjectID } from 'bson';
|
||||
|
||||
Meteor.publish('attachmentsList', function(limit) {
|
||||
const ret = Attachments.find(
|
||||
const ret = ReactiveCache.getAttachments(
|
||||
{},
|
||||
{
|
||||
fields: {
|
||||
|
@ -19,6 +19,7 @@ Meteor.publish('attachmentsList', function(limit) {
|
|||
},
|
||||
limit: limit,
|
||||
},
|
||||
true,
|
||||
).cursor;
|
||||
return ret;
|
||||
});
|
||||
|
|
|
@ -793,7 +793,7 @@ function findCards(sessionId, query) {
|
|||
ReactiveCache.getUsers({ _id: { $in: users } }, { fields: Users.safeFields }, true),
|
||||
ReactiveCache.getChecklists({ cardId: { $in: cards.map(c => c._id) } }, {}, true),
|
||||
ReactiveCache.getChecklistItems({ cardId: { $in: cards.map(c => c._id) } }, {}, true),
|
||||
Attachments.find({ 'meta.cardId': { $in: cards.map(c => c._id) } }).cursor,
|
||||
ReactiveCache.getAttachments({ 'meta.cardId': { $in: cards.map(c => c._id) } }, {}, true).cursor,
|
||||
ReactiveCache.getCardComments({ cardId: { $in: cards.map(c => c._id) } }, {}, true),
|
||||
SessionData.find({ userId, sessionId }),
|
||||
];
|
||||
|
|
|
@ -10,13 +10,17 @@ Meteor.publish('notificationActivities', () => {
|
|||
|
||||
// gets all attachments associated with activities associated with the current user
|
||||
Meteor.publish('notificationAttachments', function() {
|
||||
const ret = Attachments.find({
|
||||
_id: {
|
||||
$in: activities()
|
||||
.map(v => v.attachmentId)
|
||||
.filter(v => !!v),
|
||||
}.cursor,
|
||||
});
|
||||
const ret = ReactiveCache.getAttachments(
|
||||
{
|
||||
_id: {
|
||||
$in: activities()
|
||||
.map(v => v.attachmentId)
|
||||
.filter(v => !!v),
|
||||
},
|
||||
},
|
||||
{},
|
||||
true,
|
||||
).cursor;
|
||||
return ret;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue