Added ability to remove self from readers.

Closes #125.
This commit is contained in:
Jacob
2017-08-09 02:18:46 +01:00
parent 73d1419ee9
commit a1d9f7f5bb
5 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
Meteor.methods({
removeMeFromReaders: function(charId) {
var userId = Meteor.userId();
var character = Characters.findOne(charId);
if (!character) return;
if (!_.contains(character.readers, userId)) return;
Characters.update(charId, {$pull: {"readers": userId}}); //we don't check write permission as you should always be able to remove youself from readers
}
});