[web] emit project:membership:changed when removing self from project (#33143)

GitOrigin-RevId: 5a101add69e0077f667f98f5b95c2476ad3085d4
This commit is contained in:
Kristina
2026-05-04 10:32:01 +02:00
committed by Copybot
parent 799dcf618b
commit fdc939fe0a
2 changed files with 11 additions and 0 deletions

View File

@@ -63,6 +63,9 @@ async function removeSelfFromProject(req, res, next) {
const projectId = req.params.Project_id
const userId = SessionManager.getLoggedInUserId(req.session)
await _removeUserIdFromProject(projectId, userId)
EditorRealTimeController.emitToRoom(projectId, 'project:membership:changed', {
members: true,
})
ProjectAuditLogHandler.addEntryInBackground(
projectId,

View File

@@ -274,6 +274,14 @@ describe('CollaboratorsController', function () {
ctx.res.sendStatus.calledWith(204).should.equal(true)
})
it('should emit a project:membership:changed event to the project', function (ctx) {
expect(ctx.EditorRealTimeController.emitToRoom).to.have.been.calledWith(
ctx.projectId,
'project:membership:changed',
{ members: true }
)
})
it('should write a project audit log', function (ctx) {
ctx.ProjectAuditLogHandler.addEntryInBackground.should.have.been.calledWith(
ctx.projectId,