In-progress implementing usernames for share dialog

This commit is contained in:
Stefan Zermatten
2015-04-24 12:16:12 +02:00
parent e0209df270
commit 31e7b8d610
3 changed files with 35 additions and 28 deletions

View File

@@ -1,14 +1,13 @@
Meteor.publish("singleCharacter", function(characterId, userId){
if (
Characters.findOne({
_id: characterId,
$or: [
{readers: userId},
{writers: userId},
{owner: userId},
],
})
){
var char = Characters.findOne({
_id: characterId,
$or: [
{readers: userId},
{writers: userId},
{owner: userId},
],
});
if (char){
return [
Characters.find({_id: characterId}),
//get all the assets for this character including soft deleted ones
@@ -25,6 +24,10 @@ Meteor.publish("singleCharacter", function(characterId, userId){
SpellLists.find ({charId: characterId}, {removed: true}),
TemporaryHitPoints.find({charId: characterId}, {removed: true}),
Proficiencies.find ({charId: characterId}, {removed: true}),
Meteor.users.find (
{_id: {$in: _.union(char.readers, char.writers)}},
{fields: {username: 1}}
),
];
}
});