mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Do not track anonymous sessions
And DRY the controller a bit.
This commit is contained in:
parent
8714909a9a
commit
4ca71fb379
1 changed files with 16 additions and 16 deletions
|
@ -4,25 +4,25 @@ AuthenticationController = require("../Authentication/AuthenticationController")
|
|||
|
||||
module.exports = AnalyticsController =
|
||||
updateEditingSession: (req, res, next) ->
|
||||
userId = AuthenticationController.getLoggedInUserId(req) or req.sessionID
|
||||
userId = AuthenticationController.getLoggedInUserId(req)
|
||||
projectId = req.params.projectId
|
||||
|
||||
if userId?
|
||||
AnalyticsManager.updateEditingSession userId, projectId, {}, (error) ->
|
||||
if error instanceof Errors.ServiceNotConfiguredError
|
||||
# ignore, no-op
|
||||
return res.send(204)
|
||||
else if error?
|
||||
return next(error)
|
||||
respondWith(error, res, next)
|
||||
else
|
||||
return res.send 204
|
||||
res.send 204
|
||||
|
||||
recordEvent: (req, res, next) ->
|
||||
user_id = AuthenticationController.getLoggedInUserId(req) or req.sessionID
|
||||
AnalyticsManager.recordEvent user_id, req.params.event, req.body, (error) ->
|
||||
respondWith(error, res, next)
|
||||
|
||||
respondWith = (error, res, next) ->
|
||||
if error instanceof Errors.ServiceNotConfiguredError
|
||||
# ignore, no-op
|
||||
return res.send(204)
|
||||
res.send(204)
|
||||
else if error?
|
||||
return next(error)
|
||||
next(error)
|
||||
else
|
||||
return res.send 204
|
||||
res.send 204
|
||||
|
|
Loading…
Reference in a new issue