mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Record new project event
This commit is contained in:
parent
8781023b80
commit
4b291fab2a
2 changed files with 7 additions and 0 deletions
|
@ -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) ->)->
|
||||
|
|
|
@ -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: ()->,
|
||||
|
|
Loading…
Reference in a new issue