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')
|
fs = require('fs')
|
||||||
Path = require "path"
|
Path = require "path"
|
||||||
_ = require "underscore"
|
_ = require "underscore"
|
||||||
|
AnalyticsManger = require("../Analytics/AnalyticsManager")
|
||||||
|
|
||||||
module.exports = ProjectCreationHandler =
|
module.exports = ProjectCreationHandler =
|
||||||
|
|
||||||
|
@ -46,6 +47,9 @@ module.exports = ProjectCreationHandler =
|
||||||
project.spellCheckLanguage = user.ace.spellCheckLanguage
|
project.spellCheckLanguage = user.ace.spellCheckLanguage
|
||||||
project.save (err)->
|
project.save (err)->
|
||||||
return callback(err) if err?
|
return callback(err) if err?
|
||||||
|
AnalyticsManger.recordEvent(
|
||||||
|
owner_id, 'project-created', { projectId: project._id }
|
||||||
|
)
|
||||||
callback err, project
|
callback err, project
|
||||||
|
|
||||||
createBasicProject : (owner_id, projectName, callback = (error, project) ->)->
|
createBasicProject : (owner_id, projectName, callback = (error, project) ->)->
|
||||||
|
|
|
@ -52,6 +52,8 @@ describe 'ProjectCreationHandler', ->
|
||||||
|
|
||||||
@Settings = apis: { project_history: {} }
|
@Settings = apis: { project_history: {} }
|
||||||
|
|
||||||
|
@AnalyticsManger = recordEvent: sinon.stub()
|
||||||
|
|
||||||
@handler = SandboxedModule.require modulePath, requires:
|
@handler = SandboxedModule.require modulePath, requires:
|
||||||
'../../models/User': User:@User
|
'../../models/User': User:@User
|
||||||
'../../models/Project':{Project:@ProjectModel}
|
'../../models/Project':{Project:@ProjectModel}
|
||||||
|
@ -60,6 +62,7 @@ describe 'ProjectCreationHandler', ->
|
||||||
'./ProjectEntityUpdateHandler':@ProjectEntityUpdateHandler
|
'./ProjectEntityUpdateHandler':@ProjectEntityUpdateHandler
|
||||||
"./ProjectDetailsHandler":@ProjectDetailsHandler
|
"./ProjectDetailsHandler":@ProjectDetailsHandler
|
||||||
"settings-sharelatex": @Settings
|
"settings-sharelatex": @Settings
|
||||||
|
"../Analytics/AnalyticsManager": @AnalyticsManger
|
||||||
'logger-sharelatex': {log:->}
|
'logger-sharelatex': {log:->}
|
||||||
"metrics-sharelatex": {
|
"metrics-sharelatex": {
|
||||||
inc: ()->,
|
inc: ()->,
|
||||||
|
|
Loading…
Reference in a new issue