Merged PR 790: AuthorのNotificationフラグを見てタスク完了メールの送信先を変更するよう修正

## 概要
[Task3818: 対応](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3818)

- AuthorのNotificationフラグがOFFのときには、Authorに対してタスク完了通知メールが送信されないよう修正しました。

## レビューポイント
- 動作確認項目に不足はないか?

## 動作確認状況
- ローカルで確認しました
    - AuthorのNotificationON時にはメール宛先に入っており、OFF時には宛先から外れること
    - TypistはNotificationON/OFF関わらずメール宛先に入っていること
This commit is contained in:
Kentaro Fukunaga 2024-02-29 06:36:23 +00:00
parent ce6e09a7d0
commit 9ca9b7a144
2 changed files with 5 additions and 4 deletions

View File

@ -435,7 +435,7 @@ export class TasksService {
`author_id not found. audioFileId: ${audioFileId}. account_id: ${user.account_id}`, `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( await this.usersRepository.findUserByAuthorId(
context, context,
task.file.author_id, task.file.author_id,
@ -454,6 +454,7 @@ export class TasksService {
]); ]);
// メール送信に必要な情報を取得 // メール送信に必要な情報を取得
// Author通知ON/OFF関わらずAuthor名は必要なため、情報の取得は行う
const author = usersInfo.find((x) => x.id === authorExternalId); const author = usersInfo.find((x) => x.id === authorExternalId);
if (!author) { if (!author) {
throw new Error(`author not found. id=${authorExternalId}`); throw new Error(`author not found. id=${authorExternalId}`);
@ -488,7 +489,7 @@ export class TasksService {
// メール送信 // メール送信
this.sendgridService.sendMailWithU117( this.sendgridService.sendMailWithU117(
context, context,
authorEmail, authorNotification ? authorEmail : null,
typistEmail, typistEmail,
authorName, authorName,
task.file.file_name.replace('.zip', ''), task.file.file_name.replace('.zip', ''),

View File

@ -875,7 +875,7 @@ export class SendGridService {
*/ */
async sendMailWithU117( async sendMailWithU117(
context: Context, context: Context,
authorEmail: string, authorEmail: string | null,
typistEmail: string, typistEmail: string,
authorName: string, authorName: string,
fileName: string, fileName: string,
@ -903,7 +903,7 @@ export class SendGridService {
// メールを送信する // メールを送信する
await this.sendMail( await this.sendMail(
context, context,
[authorEmail, typistEmail], [authorEmail, typistEmail].filter((x): x is string => x !== null), // authorEmailがnullの場合は除外する
[], [],
this.mailFrom, this.mailFrom,
subject, subject,