Merge remote-tracking branch 'upstream/devel' into devel

This commit is contained in:
Xavier Priour 2015-12-16 16:23:58 +01:00
commit 0608b90d3b
3 changed files with 53 additions and 92 deletions

View file

@ -18,13 +18,13 @@ es5-shim
aldeed:collection2 aldeed:collection2
cfs:gridfs cfs:gridfs
cfs:standard-packages cfs:standard-packages
cottz:publish-relations
dburles:collection-helpers dburles:collection-helpers
idmontie:migrations idmontie:migrations
matb33:collection-hooks matb33:collection-hooks
matteodem:easy-search matteodem:easy-search
mongo mongo
mquandalle:collection-mutations mquandalle:collection-mutations
reywood:publish-composite
# Account system # Account system
accounts-password accounts-password

View file

@ -39,6 +39,7 @@ check@1.1.0
chuangbo:cookie@1.1.0 chuangbo:cookie@1.1.0
coffeescript@1.0.11 coffeescript@1.0.11
cosmos:browserify@0.9.2 cosmos:browserify@0.9.2
cottz:publish-relations@2.0.0
dburles:collection-helpers@1.0.4 dburles:collection-helpers@1.0.4
ddp@1.2.2 ddp@1.2.2
ddp-client@1.2.1 ddp-client@1.2.1
@ -120,7 +121,6 @@ reactive-dict@1.1.3
reactive-var@1.0.6 reactive-var@1.0.6
reload@1.1.4 reload@1.1.4
retry@1.0.4 retry@1.0.4
reywood:publish-composite@1.4.2
routepolicy@1.0.6 routepolicy@1.0.6
seriousm:emoji-continued@1.4.0 seriousm:emoji-continued@1.4.0
service-configuration@1.0.5 service-configuration@1.0.5

View file

@ -55,11 +55,10 @@ Meteor.publish('archivedBoards', function() {
}); });
}); });
Meteor.publishComposite('board', function(boardId) { Meteor.publishRelations('board', function(boardId) {
check(boardId, String); check(boardId, String);
return {
find() { this.cursor(Boards.find({
return Boards.find({
_id: boardId, _id: boardId,
archived: false, archived: false,
// If the board is not public the user has to be a member of it to see // If the board is not public the user has to be a member of it to see
@ -68,17 +67,8 @@ Meteor.publishComposite('board', function(boardId) {
{ permission: 'public' }, { permission: 'public' },
{ members: { $elemMatch: { userId: this.userId, isActive: true }}}, { members: { $elemMatch: { userId: this.userId, isActive: true }}},
], ],
}, { limit: 1 }); }, { limit: 1 }), function(boardId, board) {
}, this.cursor(Lists.find({ boardId }));
children: [
// Lists
{
find(board) {
return Lists.find({
boardId: board._id,
});
},
},
// Cards and cards comments // Cards and cards comments
// XXX Originally we were publishing the card documents as a child of the // XXX Originally we were publishing the card documents as a child of the
@ -88,11 +78,9 @@ Meteor.publishComposite('board', function(boardId) {
// //
// https://github.com/englue/meteor-publish-composite/issues/29 // https://github.com/englue/meteor-publish-composite/issues/29
// //
// I then tried to replace publish-composite by cottz:publish, but it had // cottz:publish had a similar problem:
// a similar problem:
// //
// https://github.com/Goluis/cottz-publish/issues/4 // https://github.com/Goluis/cottz-publish/issues/4
// https://github.com/wekan/wekan/pull/78
// //
// The current state of relational publishing in meteor is a bit sad, // The current state of relational publishing in meteor is a bit sad,
// there are a lot of various packages, with various APIs, some of them // there are a lot of various packages, with various APIs, some of them
@ -103,49 +91,22 @@ Meteor.publishComposite('board', function(boardId) {
// //
// And in the meantime our code below works pretty well -- it's not even a // And in the meantime our code below works pretty well -- it's not even a
// hack! // hack!
{ this.cursor(Cards.find({ boardId }), function(cardId) {
find(board) { this.cursor(CardComments.find({ cardId }));
return Cards.find({ this.cursor(Attachments.find({ cardId }));
boardId: board._id,
}); });
},
children: [
// comments
{
find(card) {
return CardComments.find({
cardId: card._id,
});
},
},
// Attachments
{
find(card) {
return Attachments.find({
cardId: card._id,
});
},
},
],
},
// Board members. This publication also includes former board members that // Board members. This publication also includes former board members that
// aren't members anymore but may have some activities attached to them in // aren't members anymore but may have some activities attached to them in
// the history. // the history.
{ //
find(board) { this.cursor(Users.find({
return Users.find({
_id: { $in: _.pluck(board.members, 'userId') }, _id: { $in: _.pluck(board.members, 'userId') },
}); }), function(userId) {
},
// Presence indicators // Presence indicators
children: [{ this.cursor(presences.find({ userId }));
find(user) { });
return presences.find({userId: user._id}); });
},
}], return this.ready();
},
],
};
}); });