fix: comment send email

This commit is contained in:
Innei
2022-04-09 14:40:25 +08:00
parent 92df4dd243
commit d5328881bd
2 changed files with 4 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ export class CommentModel extends BaseModel {
author!: string
@prop({ trim: true })
mail?: string
mail: string
@prop({
trim: true,

View File

@@ -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,