From d5328881bdeae617042dc952e4df256a6e537fff Mon Sep 17 00:00:00 2001 From: Innei Date: Sat, 9 Apr 2022 14:40:25 +0800 Subject: [PATCH] fix: comment send email --- src/modules/comment/comment.model.ts | 2 +- src/modules/comment/comment.service.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/comment/comment.model.ts b/src/modules/comment/comment.model.ts index 23644450..2f679eb2 100644 --- a/src/modules/comment/comment.model.ts +++ b/src/modules/comment/comment.model.ts @@ -60,7 +60,7 @@ export class CommentModel extends BaseModel { author!: string @prop({ trim: true }) - mail?: string + mail: string @prop({ trim: true, diff --git a/src/modules/comment/comment.service.ts b/src/modules/comment/comment.service.ts index ee7bf700..0ad5c544 100644 --- a/src/modules/comment/comment.service.ts +++ b/src/modules/comment/comment.service.ts @@ -232,17 +232,17 @@ export class CommentService { time.getMonth() + 1 }/${time.getFullYear()}` - if (!parent || !parent.mail || !refDoc || !master.mail || !model.mail) { + if (!refDoc || !master.mail) { return } this.mailService.sendCommentNotificationMail({ - to: type === ReplyMailType.Owner ? master.mail : parent.mail, + to: type === ReplyMailType.Owner ? master.mail : parent!.mail, type, source: { title: refDoc.title, text: model.text, - author: type === ReplyMailType.Guest ? parent.author : model.author, + author: type === ReplyMailType.Guest ? parent!.author : model.author, master: master.name, link: await this.resolveUrlByType(refType, refDoc), time: parsedTime,