Move every Attachments.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory server/)

This commit is contained in:
Martin Filser 2023-03-12 18:33:38 +01:00
parent d6ca13a61d
commit e53b63541e
3 changed files with 14 additions and 9 deletions

View file

@ -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;
});

View file

@ -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 }),
];

View file

@ -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;
});