track when users accept invites

This commit is contained in:
Henry Oswald 2016-08-19 18:33:03 +01:00
parent 50b3403983
commit 130fece0f6
2 changed files with 4 additions and 1 deletions

View file

@ -7,7 +7,7 @@ logger = require('logger-sharelatex')
EmailHelper = require "../Helpers/EmailHelper"
EditorRealTimeController = require("../Editor/EditorRealTimeController")
NotificationsBuilder = require("../Notifications/NotificationsBuilder")
AnalyticsManger = require("../Analytics/AnalyticsManager")
module.exports = CollaboratorsInviteController =
@ -120,4 +120,5 @@ module.exports = CollaboratorsInviteController =
logger.err {projectId, inviteId}, "error accepting invite by token"
return next(err)
EditorRealTimeController.emitToRoom projectId, 'project:membership:changed', {invites: true, members: true}
AnalyticsManger.recordEvent(currentUser._id, "project-invite-accept", {inviteId:inviteId, projectId:projectId})
res.redirect "/project/#{projectId}"

View file

@ -11,6 +11,7 @@ ObjectId = require("mongojs").ObjectId
describe "CollaboratorsInviteController", ->
beforeEach ->
@AnalyticsManger = recordEvent: sinon.stub()
@CollaboratorsInviteController = SandboxedModule.require modulePath, requires:
"../Project/ProjectGetter": @ProjectGetter = {}
'../Subscription/LimitationsManager' : @LimitationsManager = {}
@ -20,6 +21,7 @@ describe "CollaboratorsInviteController", ->
'logger-sharelatex': @logger = {err: sinon.stub(), error: sinon.stub(), log: sinon.stub()}
"../Editor/EditorRealTimeController": @EditorRealTimeController = {emitToRoom: sinon.stub()}
"../Notifications/NotificationsBuilder": @NotificationsBuilder = {}
"../Analytics/AnalyticsManager": @AnalyticsManger
@res = new MockResponse()
@req = new MockRequest()