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,