mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #19814 from overleaf/tm-link-sharing-project-joined-event-for-treatment
Add project-joined event when adding as Editor via link sharing GitOrigin-RevId: 40f538376b90a45877859be9e48a0b4c45c9641d
This commit is contained in:
parent
d2464abc7c
commit
2ee528a9d2
2 changed files with 18 additions and 0 deletions
|
@ -340,6 +340,14 @@ async function grantTokenAccessReadAndWrite(req, res, next) {
|
|||
req.ip,
|
||||
{ privileges: 'readAndWrite' }
|
||||
)
|
||||
AnalyticsManager.recordEventForUserInBackground(
|
||||
userId,
|
||||
'project-joined',
|
||||
{
|
||||
mode: 'read-write',
|
||||
projectId: project._id.toString(),
|
||||
}
|
||||
)
|
||||
// Currently does not enforce the collaborator limit (warning phase)
|
||||
await CollaboratorsHandler.promises.addUserIdToProject(
|
||||
project._id,
|
||||
|
|
|
@ -108,6 +108,7 @@ describe('TokenAccessController', function () {
|
|||
|
||||
this.AnalyticsManager = {
|
||||
recordEventForSession: sinon.stub(),
|
||||
recordEventForUserInBackground: sinon.stub(),
|
||||
}
|
||||
|
||||
this.UserGetter = {
|
||||
|
@ -252,6 +253,15 @@ describe('TokenAccessController', function () {
|
|||
)
|
||||
})
|
||||
|
||||
it('records a project-joined event for the user', function () {
|
||||
expect(
|
||||
this.AnalyticsManager.recordEventForUserInBackground
|
||||
).to.have.been.calledWith(this.user._id, 'project-joined', {
|
||||
mode: 'read-write',
|
||||
projectId: this.project._id.toString(),
|
||||
})
|
||||
})
|
||||
|
||||
it('emits a project membership changed event', function () {
|
||||
expect(
|
||||
this.EditorRealTimeController.emitToRoom
|
||||
|
|
Loading…
Reference in a new issue