From fdc939fe0a10d4e28100b1f09486251446895dea Mon Sep 17 00:00:00 2001 From: Kristina <7614497+khjrtbrg@users.noreply.github.com> Date: Mon, 4 May 2026 10:32:01 +0200 Subject: [PATCH] [web] emit project:membership:changed when removing self from project (#33143) GitOrigin-RevId: 5a101add69e0077f667f98f5b95c2476ad3085d4 --- .../Features/Collaborators/CollaboratorsController.mjs | 3 +++ .../src/Collaborators/CollaboratorsController.test.mjs | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/services/web/app/src/Features/Collaborators/CollaboratorsController.mjs b/services/web/app/src/Features/Collaborators/CollaboratorsController.mjs index f7ce8ece8a..eb2cb5153b 100644 --- a/services/web/app/src/Features/Collaborators/CollaboratorsController.mjs +++ b/services/web/app/src/Features/Collaborators/CollaboratorsController.mjs @@ -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, diff --git a/services/web/test/unit/src/Collaborators/CollaboratorsController.test.mjs b/services/web/test/unit/src/Collaborators/CollaboratorsController.test.mjs index cafc5cddd3..7446128fa6 100644 --- a/services/web/test/unit/src/Collaborators/CollaboratorsController.test.mjs +++ b/services/web/test/unit/src/Collaborators/CollaboratorsController.test.mjs @@ -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,