summaryrefslogtreecommitdiffstats
path: root/server/publications
diff options
context:
space:
mode:
authorwekan <wekan@wekan-sandstorm.workgroup>2019-05-13 11:01:50 +0200
committerwekan <wekan@wekan-sandstorm.workgroup>2019-05-13 11:01:50 +0200
commitab4fec0f3c6d5a613b309ae6fac41dbb31f1765d (patch)
tree385dbc5f574085f278182014edb7871780f851b9 /server/publications
parentb98347947661e5c79f286a4e5d7f11e614dfb43c (diff)
downloadwekan-ab4fec0f3c6d5a613b309ae6fac41dbb31f1765d.tar.gz
wekan-ab4fec0f3c6d5a613b309ae6fac41dbb31f1765d.tar.bz2
wekan-ab4fec0f3c6d5a613b309ae6fac41dbb31f1765d.zip
Fixed #2338 -> Slow opening of big boards with too many archived items
Diffstat (limited to 'server/publications')
-rw-r--r--server/publications/boards.js12
-rw-r--r--server/publications/fast-render.js2
2 files changed, 9 insertions, 5 deletions
diff --git a/server/publications/boards.js b/server/publications/boards.js
index 52940739..f11e776b 100644
--- a/server/publications/boards.js
+++ b/server/publications/boards.js
@@ -59,9 +59,12 @@ Meteor.publish('archivedBoards', function() {
});
});
-Meteor.publishRelations('board', function(boardId) {
+// If isArchived = false, this will only return board elements which are not archived.
+// If isArchived = true, this will only return board elements which are archived.
+Meteor.publishRelations('board', function(boardId, isArchived) {
this.unblock();
check(boardId, String);
+ check(isArchived, Boolean);
const thisUserId = this.userId;
this.cursor(Boards.find({
@@ -75,8 +78,8 @@ Meteor.publishRelations('board', function(boardId) {
],
// Sort required to ensure oplog usage
}, { limit: 1, sort: { _id: 1 } }), function(boardId, board) {
- this.cursor(Lists.find({ boardId }));
- this.cursor(Swimlanes.find({ boardId }));
+ this.cursor(Lists.find({ boardId: boardId, archived: isArchived }));
+ this.cursor(Swimlanes.find({ boardId: boardId, archived: isArchived }));
this.cursor(Integrations.find({ boardId }));
this.cursor(CustomFields.find({ boardIds: {$in: [boardId]} }, { sort: { name: 1 } }));
@@ -115,8 +118,9 @@ Meteor.publishRelations('board', function(boardId) {
parentCards.selector = (_ids) => ({ parentId: _ids });
const boards = this.join(Boards);
const subCards = this.join(Cards);
+ subCards.selector = (_ids) => ({ archived: isArchived });
- this.cursor(Cards.find({ boardId: {$in: [boardId, board.subtasksDefaultBoardId]}}), function(cardId, card) {
+ this.cursor(Cards.find({ boardId: {$in: [boardId, board.subtasksDefaultBoardId]}, archived: isArchived }), function(cardId, card) {
if (card.type === 'cardType-linkedCard') {
const impCardId = card.linkedId;
subCards.push(impCardId);
diff --git a/server/publications/fast-render.js b/server/publications/fast-render.js
index 7c54c686..4829ad57 100644
--- a/server/publications/fast-render.js
+++ b/server/publications/fast-render.js
@@ -5,5 +5,5 @@ FastRender.onAllRoutes(function() {
});
FastRender.route('/b/:id/:slug', function({ id }) {
- this.subscribe('board', id);
+ this.subscribe('board', id, false);
});