mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #25360 from overleaf/jel-group-audit-log-join
[web] Update group audit log when user joins GitOrigin-RevId: 81c0d5003cdde384cb5ff90b57f6aa8b8dae0ee2
This commit is contained in:
@@ -120,6 +120,18 @@ describe('SubscriptionUpdater', function () {
|
||||
},
|
||||
},
|
||||
],
|
||||
mongo: {
|
||||
options: {
|
||||
appname: 'web',
|
||||
maxPoolSize: 100,
|
||||
serverSelectionTimeoutMS: 60000,
|
||||
socketTimeoutMS: 60000,
|
||||
monitorCommands: true,
|
||||
family: 4,
|
||||
},
|
||||
url: 'mongodb://mongo/test-overleaf',
|
||||
hasSecondaries: false,
|
||||
},
|
||||
}
|
||||
|
||||
this.UserFeaturesUpdater = {
|
||||
@@ -181,6 +193,13 @@ describe('SubscriptionUpdater', function () {
|
||||
}),
|
||||
'../../infrastructure/Features': this.Features,
|
||||
'../User/UserAuditLogHandler': this.UserAuditLogHandler,
|
||||
'../../infrastructure/Modules': (this.Modules = {
|
||||
promises: {
|
||||
hooks: {
|
||||
fire: sinon.stub().resolves(),
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -486,6 +505,7 @@ describe('SubscriptionUpdater', function () {
|
||||
this.SubscriptionModel.updateOne
|
||||
.calledWith(searchOps, insertOperation)
|
||||
.should.equal(true)
|
||||
expect(this.SubscriptionModel.updateOne.lastCall.args[2].session).to.exist
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEventForUserInBackground,
|
||||
this.otherUserId,
|
||||
@@ -571,6 +591,24 @@ describe('SubscriptionUpdater', function () {
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
it('should add an entry to the group audit log when joining a group', async function () {
|
||||
await this.SubscriptionUpdater.promises.addUserToGroup(
|
||||
this.subscription._id,
|
||||
this.otherUserId,
|
||||
{ ipAddress: '0:0:0:0', initiatorId: 'user123' }
|
||||
)
|
||||
|
||||
expect(this.Modules.promises.hooks.fire).to.have.been.calledWith(
|
||||
'addGroupAuditLogEntry',
|
||||
{
|
||||
groupId: this.subscription._id,
|
||||
initiatorId: 'user123',
|
||||
ipAddress: '0:0:0:0',
|
||||
operation: 'join-group',
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('removeUserFromGroup', function () {
|
||||
|
||||
Reference in New Issue
Block a user