Merge branch 'master' of github.com:SachaG/Telescope

This commit is contained in:
Sacha Greif 2013-11-06 09:29:45 +09:00
commit e7523e7e49

View file

@ -24,7 +24,7 @@ Meteor.methods({
var headline = cleanUp(post.headline),
body = cleanUp(post.body),
user = Meteor.user(),
userId = post.userId || user._id,
userId = user._id,
submitted = parseInt(post.submitted) || new Date().getTime(),
defaultStatus = getSetting('requirePostsApproval') ? STATUS_PENDING : STATUS_APPROVED,
status = post.status || defaultStatus,
@ -34,7 +34,10 @@ Meteor.methods({
postInterval = Math.abs(parseInt(getSetting('postInterval', 30))),
maxPostsPer24Hours = Math.abs(parseInt(getSetting('maxPostsPerDay', 30))),
postId = '';
if(isAdmin(Meteor.user()) {
userId = post.userId || user._id // Don't trust HTML from the users, they are bad
}
// check that user can post
if (!user || !canPost(user))
throw new Meteor.Error(601, 'You need to login or be invited to post new stories.');