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:
@@ -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);
|
||||
|
||||
@@ -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"});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user