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

This commit is contained in:
Martin Filser 2023-03-12 18:06:39 +01:00
parent 5fe78a477c
commit 06f0ceebd1
2 changed files with 12 additions and 8 deletions

View file

@ -478,7 +478,7 @@ function buildSelector(queryParams) {
if (queryParams.text) { if (queryParams.text) {
const regex = new RegExp(escapeForRegex(queryParams.text), 'i'); const regex = new RegExp(escapeForRegex(queryParams.text), 'i');
const items = ChecklistItems.find( const items = ReactiveCache.getChecklistItems(
{ title: regex }, { title: regex },
{ fields: { cardId: 1, checklistId: 1 } }, { fields: { cardId: 1, checklistId: 1 } },
); );
@ -792,7 +792,7 @@ function findCards(sessionId, query) {
ReactiveCache.getCustomFields({ _id: { $in: customFieldIds } }, {}, true), ReactiveCache.getCustomFields({ _id: { $in: customFieldIds } }, {}, true),
ReactiveCache.getUsers({ _id: { $in: users } }, { fields: Users.safeFields }, true), ReactiveCache.getUsers({ _id: { $in: users } }, { fields: Users.safeFields }, true),
Checklists.find({ cardId: { $in: cards.map(c => c._id) } }), Checklists.find({ cardId: { $in: cards.map(c => c._id) } }),
ChecklistItems.find({ cardId: { $in: cards.map(c => c._id) } }), ReactiveCache.getChecklistItems({ cardId: { $in: cards.map(c => c._id) } }, {}, true),
Attachments.find({ 'meta.cardId': { $in: cards.map(c => c._id) } }).cursor, Attachments.find({ 'meta.cardId': { $in: cards.map(c => c._id) } }).cursor,
CardComments.find({ cardId: { $in: cards.map(c => c._id) } }), CardComments.find({ cardId: { $in: cards.map(c => c._id) } }),
SessionData.find({ userId, sessionId }), SessionData.find({ userId, sessionId }),

View file

@ -38,13 +38,17 @@ Meteor.publish('notificationCards', function() {
// gets all checklistItems associated with activities associated with the current user // gets all checklistItems associated with activities associated with the current user
Meteor.publish('notificationChecklistItems', function() { Meteor.publish('notificationChecklistItems', function() {
const ret = ChecklistItems.find({ const ret = ReactiveCache.getChecklistItems(
_id: { {
$in: activities() _id: {
.map(v => v.checklistItemId) $in: activities()
.filter(v => !!v), .map(v => v.checklistItemId)
.filter(v => !!v),
},
}, },
}); {},
true,
);
return ret; return ret;
}); });