Record new project event

This commit is contained in:
Tim Alby 2018-02-22 16:22:55 -05:00
parent 8781023b80
commit 4b291fab2a
2 changed files with 7 additions and 0 deletions

View file

@ -12,6 +12,7 @@ User = require('../../models/User').User
fs = require('fs')
Path = require "path"
_ = require "underscore"
AnalyticsManger = require("../Analytics/AnalyticsManager")
module.exports = ProjectCreationHandler =
@ -46,6 +47,9 @@ module.exports = ProjectCreationHandler =
project.spellCheckLanguage = user.ace.spellCheckLanguage
project.save (err)->
return callback(err) if err?
AnalyticsManger.recordEvent(
owner_id, 'project-created', { projectId: project._id }
)
callback err, project
createBasicProject : (owner_id, projectName, callback = (error, project) ->)->

View file

@ -52,6 +52,8 @@ describe 'ProjectCreationHandler', ->
@Settings = apis: { project_history: {} }
@AnalyticsManger = recordEvent: sinon.stub()
@handler = SandboxedModule.require modulePath, requires:
'../../models/User': User:@User
'../../models/Project':{Project:@ProjectModel}
@ -60,6 +62,7 @@ describe 'ProjectCreationHandler', ->
'./ProjectEntityUpdateHandler':@ProjectEntityUpdateHandler
"./ProjectDetailsHandler":@ProjectDetailsHandler
"settings-sharelatex": @Settings
"../Analytics/AnalyticsManager": @AnalyticsManger
'logger-sharelatex': {log:->}
"metrics-sharelatex": {
inc: ()->,