diff --git a/dictation_server/src/features/tasks/tasks.service.ts b/dictation_server/src/features/tasks/tasks.service.ts index 7b7c127..898a8f9 100644 --- a/dictation_server/src/features/tasks/tasks.service.ts +++ b/dictation_server/src/features/tasks/tasks.service.ts @@ -435,7 +435,7 @@ export class TasksService { `author_id not found. audioFileId: ${audioFileId}. account_id: ${user.account_id}`, ); } - const { external_id: authorExternalId } = + const { external_id: authorExternalId, notification: authorNotification } = await this.usersRepository.findUserByAuthorId( context, task.file.author_id, @@ -454,6 +454,7 @@ export class TasksService { ]); // メール送信に必要な情報を取得 + // Author通知ON/OFF関わらずAuthor名は必要なため、情報の取得は行う const author = usersInfo.find((x) => x.id === authorExternalId); if (!author) { throw new Error(`author not found. id=${authorExternalId}`); @@ -488,7 +489,7 @@ export class TasksService { // メール送信 this.sendgridService.sendMailWithU117( context, - authorEmail, + authorNotification ? authorEmail : null, typistEmail, authorName, task.file.file_name.replace('.zip', ''), diff --git a/dictation_server/src/gateways/sendgrid/sendgrid.service.ts b/dictation_server/src/gateways/sendgrid/sendgrid.service.ts index 17fa39b..ac9a5df 100644 --- a/dictation_server/src/gateways/sendgrid/sendgrid.service.ts +++ b/dictation_server/src/gateways/sendgrid/sendgrid.service.ts @@ -875,7 +875,7 @@ export class SendGridService { */ async sendMailWithU117( context: Context, - authorEmail: string, + authorEmail: string | null, typistEmail: string, authorName: string, fileName: string, @@ -903,7 +903,7 @@ export class SendGridService { // メールを送信する await this.sendMail( context, - [authorEmail, typistEmail], + [authorEmail, typistEmail].filter((x): x is string => x !== null), // authorEmailがnullの場合は除外する [], this.mailFrom, subject,