From b067483a91fb97ec7506f17a4999cd4fd65614be Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Thu, 8 Apr 2021 11:13:22 +0200 Subject: [PATCH] fix(mail): add link to structure in admin new structure mail --- src/mailer/mail-templates/adminStructureCreate.ejs | 8 +++++++- src/structures/services/structures.service.ts | 2 +- src/users/users.service.ts | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mailer/mail-templates/adminStructureCreate.ejs b/src/mailer/mail-templates/adminStructureCreate.ejs index 41d58470f..47b79daa1 100644 --- a/src/mailer/mail-templates/adminStructureCreate.ejs +++ b/src/mailer/mail-templates/adminStructureCreate.ejs @@ -1,3 +1,9 @@ Bonjour<br /> <br /> -Une nouvelle structure a été créé: <strong><%= name %></strong>. +Une nouvelle structure a été créé: +<a href="<%= config.protocol %>://<%= config.host %><%= config.port ? ':' + config.port : '' %>/acteurs?id=<%= id %>" + ><strong><%= name %></strong></a +> +<br /> +Il est possible que la structure ne soit pas immédiatement visible sur la carto. L'utilisateur doit valider son compte +pour que celle-ci soit visible. diff --git a/src/structures/services/structures.service.ts b/src/structures/services/structures.service.ts index cf86a1339..441d7022d 100644 --- a/src/structures/services/structures.service.ts +++ b/src/structures/services/structures.service.ts @@ -41,7 +41,7 @@ export class StructuresService { user.save(); // Senc admin notification mail - this.userService.sendAdminNewStructureMail(createdStructure.structureName); + this.userService.sendAdminNewStructureMail(createdStructure.structureName, createdStructure._id); return createdStructure; } diff --git a/src/users/users.service.ts b/src/users/users.service.ts index e4a081cb3..00cb1129c 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -159,7 +159,7 @@ export class UsersService { /** * Send to all admins notification email for new structures */ - public async sendAdminNewStructureMail(structureName: string): Promise<any> { + public async sendAdminNewStructureMail(structureName: string, structureId: string): Promise<any> { const config = this.mailerService.config; const ejsPath = this.mailerService.getTemplateLocation(config.templates.adminStructureCreate.ejs); const jsonConfig = this.mailerService.loadJsonConfig(config.templates.adminStructureCreate.json); @@ -167,6 +167,7 @@ export class UsersService { const html = await ejs.renderFile(ejsPath, { config, name: structureName, + id: structureId, }); const admins = await this.getAdmins(); admins.forEach((admin) => { -- GitLab