Last active
January 24, 2016 12:24
-
-
Save varavut/7e185ac0a44d349a4f71 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
if (Meteor.isServer) { | |
Threads.allow({ | |
insert: function (userId, doc) { | |
if(!userId) | |
throw new Meteor.Error('Unauthorized', 'Please login before perform an action'); | |
check(doc.title, String); | |
if (doc.owner && doc.owner != userId) | |
throw new Meteor.Error('No permission', 'Can\'t create a thread in the name of other'); | |
doc.owner = userId; | |
doc.createdAt = new Date(); | |
doc.updatedAt = new Date(); | |
doc.deletedAt = null; | |
return true; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment