Last active
October 28, 2016 23:58
-
-
Save mokolodi1/29927da6b8448685dd5a9c05d119516c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// publish users that are in the specified collaborations | |
Meteor.publish("usersInCollaborations", function (collaborations) { | |
// grab the associated collaborators (personal and otherwise) for all collaborations | |
let combinedCollabs = _.reduce(collaborations, (memo, name) => { | |
// grab the collaboration | |
let collab = Collaborations.findOne({ name }); | |
// get the collaborators and add them to the working list | |
memo.concat(concat.getAssociatedCollaborators()); | |
return memo; | |
}, []); | |
return Meteor.users.find({ | |
"collaborations.personal": { $in: combinedCollabs } | |
}, { | |
fields: { | |
"profile.name": 1 | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment