Merge pull request #1798 from codecombat/master

Fixed a few crashing bugs
This commit is contained in:
Michael Schmatz 2014-11-25 10:57:31 -05:00
commit 3ab8620745
2 changed files with 3 additions and 1 deletions

View file

@ -17,6 +17,8 @@ class EarnedAchievementHandler extends Handler
get: (req, res) ->
return @getByAchievementIDs(req, res) if req.query.view is 'get-by-achievement-ids'
unless req.user
return @sendDatabaseError(res, "You need to have a user to view earned achievements")
query = { user: req.user._id+''}
projection = {}

View file

@ -31,7 +31,7 @@ class LevelSessionHandler extends Handler
hasAccessToDocument: (req, document, method=null) ->
return true if req.method is 'GET' and document.get('submitted')
return true if ('employer' in (req.user.get('permissions') ? [])) and (method ? req.method).toLowerCase() is 'get'
return true if ('employer' in (req.user?.get('permissions') ? [])) and (method ? req.method).toLowerCase() is 'get'
super(arguments...)
getCodeLanguageCounts: (req, res) ->