Skip to content
Snippets Groups Projects
Commit 25be42c9 authored by Augustin LECONTE's avatar Augustin LECONTE
Browse files

feat(profile) : owner can remove himself from structure

parent c9633621
No related branches found
No related tags found
3 merge requests!97release V1.10.0,!96release V1.10.0,!93feat/US1-admin-remove-from-struct
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -564,7 +564,10 @@ export class StructuresService {
if (!structure) {
throw new HttpException('Invalid structure id', HttpStatus.BAD_REQUEST);
}
const owners = await this.userService.getStructureOwnersMails(idStructure, emailUser);
const owners =
typeof emailUser == 'undefined'
? await this.userService.getStructureOwnersMails(structure._id, '')
: await this.userService.getStructureOwnersMails(structure._id, emailUser);
return { structure: structure, owners: owners };
}
......
......@@ -384,7 +384,7 @@ export class UsersService {
if (user) {
if (user.structuresLink.includes(Types.ObjectId(idStructure))) {
user.structuresLink = user.structuresLink.filter((structureId) => {
return structureId == Types.ObjectId(idStructure);
return !structureId.equals(idStructure);
});
await user.save();
return user.structuresLink;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment