diff --git a/src/services/user-experience.service.ts b/src/services/user-experience.service.ts index 10df3223e..60e71ca50 100644 --- a/src/services/user-experience.service.ts +++ b/src/services/user-experience.service.ts @@ -255,7 +255,11 @@ export class UserExperienceService { jobs.push(this.userExperienceRepository.deleteAll(where)); } - if (editors && !editors.includes(userId)) { + if (editors) { + if (editors.includes(userId)) { + jobs.push(this.experienceRepository.editors(id).unlinkAll()) + } + else { await this.experienceRepository.editors(id).unlinkAll(); editors.map(editor => { const link = this.experienceRepository @@ -269,7 +273,7 @@ export class UserExperienceService { jobs.push(creation); return editor; }); - +} } Promise.all(jobs) as Promise;