Can now access the name of public characters for buffs

the buffDialog can now access the name of a publicly-available character
so it can display their name as the caster
This commit is contained in:
Jacob
2017-08-09 15:30:33 +01:00
parent 64ef426035
commit 818cb3905f
2 changed files with 21 additions and 0 deletions

View File

@@ -1,3 +1,8 @@
Template.buffDialog.onCreated(function(){
var buff = Buffs.findOne(this.buffId);
Meteor.subscribe("singleCharacterName", buff.charId); //so we can access the names of public characters
});
Template.buffDialog.helpers({
buff: function(){
return Buffs.findOne(this.buffId);

View File

@@ -33,3 +33,19 @@ Meteor.publish("singleCharacter", function(characterId){
return [];
}
});
Meteor.publish("singleCharacterName", function(characterId){
userId = this.userId;
var char = Characters.findOne({
_id: characterId,
$or: [
{readers: userId},
{writers: userId},
{owner: userId},
{"settings.viewPermission": "public"},
],
});
if (char) {
return Characters.find(characterId, {fields:"name"});
}
});