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

This commit is contained in:
Martin Filser 2023-03-12 11:52:31 +01:00
parent 2a2ed1eb2c
commit 76bd3bfe1d
3 changed files with 24 additions and 17 deletions

View file

@ -53,15 +53,18 @@ Meteor.publishRelations('boards', function() {
), ),
function(boardId, board) { function(boardId, board) {
this.cursor( this.cursor(
Lists.find( ReactiveCache.getLists(
{ boardId, archived: false }, { boardId, archived: false },
{ fields: { { fields:
_id: 1, {
title: 1, _id: 1,
boardId: 1, title: 1,
archived: 1, boardId: 1,
sort: 1 archived: 1,
}} sort: 1
}
},
true,
) )
); );
this.cursor( this.cursor(
@ -217,7 +220,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
true, true,
), ),
function(boardId, board) { function(boardId, board) {
this.cursor(Lists.find({ boardId, archived: isArchived })); this.cursor(ReactiveCache.getLists({ boardId, archived: isArchived }, {}, true));
this.cursor(Swimlanes.find({ boardId, archived: isArchived })); this.cursor(Swimlanes.find({ boardId, archived: isArchived }));
this.cursor(Integrations.find({ boardId })); this.cursor(Integrations.find({ boardId }));
this.cursor(CardCommentReactions.find({ boardId })); this.cursor(CardCommentReactions.find({ boardId }));

View file

@ -77,7 +77,7 @@ Meteor.publishRelations('popupCardData', function(cardId) {
), ),
function(cardId, card) { function(cardId, card) {
this.cursor(ReactiveCache.getBoards({_id: card.boardId}, {}, true)); this.cursor(ReactiveCache.getBoards({_id: card.boardId}, {}, true));
this.cursor(Lists.find({boardId: card.boardId})); this.cursor(ReactiveCache.getLists({boardId: card.boardId}, {}, true));
}, },
); );
const ret = this.ready() const ret = this.ready()
@ -787,7 +787,7 @@ function findCards(sessionId, query) {
{ _id: { $in: swimlanes } }, { _id: { $in: swimlanes } },
{ fields: { ...fields, color: 1 } }, { fields: { ...fields, color: 1 } },
), ),
Lists.find({ _id: { $in: lists } }, { fields }), ReactiveCache.getLists({ _id: { $in: lists } }, { fields }, true),
CustomFields.find({ _id: { $in: customFieldIds } }), CustomFields.find({ _id: { $in: customFieldIds } }),
Users.find({ _id: { $in: users } }, { fields: Users.safeFields }), Users.find({ _id: { $in: users } }, { fields: Users.safeFields }),
Checklists.find({ cardId: { $in: cards.map(c => c._id) } }), Checklists.find({ cardId: { $in: cards.map(c => c._id) } }),

View file

@ -74,13 +74,17 @@ Meteor.publish('notificationComments', function() {
// gets all lists associated with activities associated with the current user // gets all lists associated with activities associated with the current user
Meteor.publish('notificationLists', function() { Meteor.publish('notificationLists', function() {
const ret = Lists.find({ const ret = ReactiveCache.getLists(
_id: { {
$in: activities() _id: {
.map(v => v.listId) $in: activities()
.filter(v => !!v), .map(v => v.listId)
.filter(v => !!v),
},
}, },
}); {},
true,
);
return ret; return ret;
}); });