mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Move every Cards.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory server/)
This commit is contained in:
parent
a533605608
commit
2a2ed1eb2c
3 changed files with 31 additions and 15 deletions
|
@ -65,7 +65,7 @@ Meteor.publishRelations('boards', function() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
this.cursor(
|
this.cursor(
|
||||||
Cards.find(
|
ReactiveCache.getCards(
|
||||||
{ boardId, archived: false },
|
{ boardId, archived: false },
|
||||||
{ fields: {
|
{ fields: {
|
||||||
_id: 1,
|
_id: 1,
|
||||||
|
@ -73,7 +73,8 @@ Meteor.publishRelations('boards', function() {
|
||||||
listId: 1,
|
listId: 1,
|
||||||
archived: 1,
|
archived: 1,
|
||||||
sort: 1
|
sort: 1
|
||||||
}}
|
}},
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -271,10 +272,13 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
|
||||||
linkedBoardCards.selector = _ids => ({ boardId: _ids });
|
linkedBoardCards.selector = _ids => ({ boardId: _ids });
|
||||||
|
|
||||||
this.cursor(
|
this.cursor(
|
||||||
Cards.find({
|
ReactiveCache.getCards({
|
||||||
boardId: { $in: [boardId, board.subtasksDefaultBoardId] },
|
boardId: { $in: [boardId, board.subtasksDefaultBoardId] },
|
||||||
archived: isArchived,
|
archived: isArchived,
|
||||||
}),
|
},
|
||||||
|
{},
|
||||||
|
true,
|
||||||
|
),
|
||||||
function(cardId, card) {
|
function(cardId, card) {
|
||||||
if (card.type === 'cardType-linkedCard') {
|
if (card.type === 'cardType-linkedCard') {
|
||||||
const impCardId = card.linkedId;
|
const impCardId = card.linkedId;
|
||||||
|
|
|
@ -56,7 +56,11 @@ import Team from "../../models/team";
|
||||||
|
|
||||||
Meteor.publish('card', cardId => {
|
Meteor.publish('card', cardId => {
|
||||||
check(cardId, String);
|
check(cardId, String);
|
||||||
const ret = Cards.find({ _id: cardId });
|
const ret = ReactiveCache.getCards(
|
||||||
|
{ _id: cardId },
|
||||||
|
{},
|
||||||
|
true,
|
||||||
|
);
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -66,7 +70,11 @@ Meteor.publish('card', cardId => {
|
||||||
Meteor.publishRelations('popupCardData', function(cardId) {
|
Meteor.publishRelations('popupCardData', function(cardId) {
|
||||||
check(cardId, String);
|
check(cardId, String);
|
||||||
this.cursor(
|
this.cursor(
|
||||||
Cards.find({_id: cardId}),
|
ReactiveCache.getCards(
|
||||||
|
{ _id: cardId },
|
||||||
|
{},
|
||||||
|
true,
|
||||||
|
),
|
||||||
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(Lists.find({boardId: card.boardId}));
|
||||||
|
@ -680,7 +688,7 @@ function findCards(sessionId, query) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
// console.log('projection:', query.projection);
|
// console.log('projection:', query.projection);
|
||||||
|
|
||||||
const cards = Cards.find(query.selector, query.projection);
|
const cards = ReactiveCache.getCards(query.selector, query.projection, true);
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
// console.log('count:', cards.count());
|
// console.log('count:', cards.count());
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,17 @@ Meteor.publish('notificationAttachments', function() {
|
||||||
|
|
||||||
// gets all cards associated with activities associated with the current user
|
// gets all cards associated with activities associated with the current user
|
||||||
Meteor.publish('notificationCards', function() {
|
Meteor.publish('notificationCards', function() {
|
||||||
const ret = Cards.find({
|
const ret = ReactiveCache.getCards(
|
||||||
_id: {
|
{
|
||||||
$in: activities()
|
_id: {
|
||||||
.map(v => v.cardId)
|
$in: activities()
|
||||||
.filter(v => !!v),
|
.map(v => v.cardId)
|
||||||
|
.filter(v => !!v),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
{},
|
||||||
|
true,
|
||||||
|
);
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue