mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-31 07:12:49 -04:00
Add user null check to logEvent
This commit is contained in:
parent
5edc8543e5
commit
e499678223
1 changed files with 4 additions and 1 deletions
|
@ -35,10 +35,13 @@ class AnalyticsLogEventHandler extends Handler
|
|||
|
||||
logEvent: (req, res) ->
|
||||
# Converts strings to string IDs where possible, and logs the event
|
||||
user = req.user._id
|
||||
user = req.user?._id
|
||||
event = req.query.event or req.body.event
|
||||
properties = req.query.properties or req.body.properties
|
||||
@sendSuccess res # Return request immediately
|
||||
unless user?
|
||||
log.warn 'No user given to analytics logEvent.'
|
||||
return
|
||||
|
||||
saveDoc = (eventID, slimProperties) ->
|
||||
doc = new AnalyticsLogEvent
|
||||
|
|
Loading…
Add table
Reference in a new issue