Analytics disabled via Features.js (#2296)

GitOrigin-RevId: b3649bf8e6ef4eb37dee38ca7c6709a282904388
This commit is contained in:
Miguel Serrano
2019-11-06 10:12:43 +00:00
committed by sharelatex
parent 35632da051
commit 9fa858bbd6
2 changed files with 8 additions and 0 deletions
@@ -3,9 +3,13 @@ const Errors = require('../Errors/Errors')
const AuthenticationController = require('../Authentication/AuthenticationController')
const InstitutionsAPI = require('../Institutions/InstitutionsAPI')
const GeoIpLookup = require('../../infrastructure/GeoIpLookup')
const Features = require('../../infrastructure/Features')
module.exports = {
updateEditingSession(req, res, next) {
if (!Features.hasFeature('analytics')) {
return res.send(204)
}
const userId = AuthenticationController.getLoggedInUserId(req)
const { projectId } = req.params
let countryCode = null
@@ -28,6 +32,9 @@ module.exports = {
},
recordEvent(req, res, next) {
if (!Features.hasFeature('analytics')) {
return res.send(204)
}
const userId =
AuthenticationController.getLoggedInUserId(req) || req.sessionID
AnalyticsManager.recordEvent(userId, req.params.event, req.body, error =>