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

This commit is contained in:
Martin Filser 2023-03-12 10:39:11 +01:00
parent 7749c0bd9a
commit a533605608
3 changed files with 12 additions and 7 deletions

View file

@ -32,7 +32,7 @@ Meteor.publishRelations('boards', function() {
// if(teamIdsUserBelongs && teamIdsUserBelongs != ''){
// teamsIds = teamIdsUserBelongs.split(',');
// }
this.cursor(Boards.find(
this.cursor(ReactiveCache.getBoards(
{
archived: false,
_id: { $in: Boards.userBoardIds(userId, false) },
@ -49,6 +49,7 @@ Meteor.publishRelations('boards', function() {
{
sort: { sort: 1 /* boards default sorting */ },
},
true,
),
function(boardId, board) {
this.cursor(
@ -87,7 +88,7 @@ Meteor.publish('boardsReport', function() {
// array to tell the client to remove the previously published docs.
if (!Match.test(userId, String) || !userId) return [];
const boards = Boards.find(
const boards = ReactiveCache.getBoards(
{
_id: { $in: Boards.userBoardIds(userId, null) },
},
@ -110,6 +111,7 @@ Meteor.publish('boardsReport', function() {
},
sort: { sort: 1 /* boards default sorting */ },
},
true,
);
const userIds = [];
@ -146,7 +148,7 @@ Meteor.publish('archivedBoards', function() {
const userId = this.userId;
if (!Match.test(userId, String)) return [];
const ret = Boards.find(
const ret = ReactiveCache.getBoards(
{
_id: { $in: Boards.userBoardIds(userId, true)},
archived: true,
@ -169,6 +171,7 @@ Meteor.publish('archivedBoards', function() {
},
sort: { archivedAt: -1, modifiedAt: -1 },
},
true,
);
return ret;
});
@ -200,7 +203,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
}
this.cursor(
Boards.find(
ReactiveCache.getBoards(
{
_id: boardId,
archived: false,
@ -210,6 +213,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
// Sort required to ensure oplog usage
},
{ limit: 1, sort: { sort: 1 /* boards default sorting */ } },
true,
),
function(boardId, board) {
this.cursor(Lists.find({ boardId, archived: isArchived }));

View file

@ -68,7 +68,7 @@ Meteor.publishRelations('popupCardData', function(cardId) {
this.cursor(
Cards.find({_id: cardId}),
function(cardId, card) {
this.cursor(Boards.find({_id: card.boardId}));
this.cursor(ReactiveCache.getBoards({_id: card.boardId}, {}, true));
this.cursor(Lists.find({boardId: card.boardId}));
},
);
@ -770,9 +770,10 @@ function findCards(sessionId, query) {
return [
cards,
Boards.find(
ReactiveCache.getBoards(
{ _id: { $in: boards } },
{ fields: { ...fields, labels: 1, color: 1 } },
true,
),
Swimlanes.find(
{ _id: { $in: swimlanes } },

View file

@ -42,7 +42,7 @@ Meteor.publish('rulesReport', () => {
rules,
Actions.find({ _id: { $in: actionIds } }),
Triggers.find({ _id: { $in: triggerIds } }),
Boards.find({ _id: { $in: boardIds } }, { fields: { title: 1 } }),
ReactiveCache.getBoards({ _id: { $in: boardIds } }, { fields: { title: 1 } }, true),
];
return ret;
});