From fdc682e810988fd02c963345b74f9a849102a19e Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Wed, 7 Dec 2022 14:55:09 -0500 Subject: [PATCH] server: remove sendEmailNotification The functions have their bodies completely comented out, which means they are doing nothing. --- .../src/services/create-notification.ts | 4 --- .../src/services/send-email-notification.ts | 32 ------------------- 2 files changed, 36 deletions(-) delete mode 100644 packages/backend/src/services/send-email-notification.ts diff --git a/packages/backend/src/services/create-notification.ts b/packages/backend/src/services/create-notification.ts index 6b04bb946..7b27c0261 100644 --- a/packages/backend/src/services/create-notification.ts +++ b/packages/backend/src/services/create-notification.ts @@ -4,7 +4,6 @@ import { Notifications, Mutings, UserProfiles, Users } from '@/models/index.js'; import { genId } from '@/misc/gen-id.js'; import { User } from '@/models/entities/user.js'; import { Notification } from '@/models/entities/notification.js'; -import { sendEmailNotification } from './send-email-notification.js'; export async function createNotification( notifieeId: User['id'], @@ -53,9 +52,6 @@ export async function createNotification( publishMainStream(notifieeId, 'unreadNotification', packed); pushNotification(notifieeId, 'notification', packed); - - if (type === 'follow') sendEmailNotification.follow(notifieeId, await Users.findOneByOrFail({ id: data.notifierId! })); - if (type === 'receiveFollowRequest') sendEmailNotification.receiveFollowRequest(notifieeId, await Users.findOneByOrFail({ id: data.notifierId! })); }, 2000); return notification; diff --git a/packages/backend/src/services/send-email-notification.ts b/packages/backend/src/services/send-email-notification.ts deleted file mode 100644 index cd3c670ac..000000000 --- a/packages/backend/src/services/send-email-notification.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { UserProfiles } from '@/models/index.js'; -import { User } from '@/models/entities/user.js'; -import { I18n } from '@/misc/i18n.js'; -import * as Acct from '@/misc/acct.js'; -import { sendEmail } from './send-email.js'; - -// TODO: locale ファイルをクライアント用とサーバー用で分けたい - -async function follow(userId: User['id'], follower: User) { - /* - const userProfile = await UserProfiles.findOneByOrFail({ userId: userId }); - if (!userProfile.email || !userProfile.emailNotificationTypes.includes('follow')) return; - const i18n = new I18n(userProfile.lang ?? 'en-US'); - // TODO: render user information html - sendEmail(userProfile.email, i18n.t('_email._follow.title'), `${follower.name} (@${Acct.toString(follower)})`, `${follower.name} (@${Acct.toString(follower)})`); - */ -} - -async function receiveFollowRequest(userId: User['id'], follower: User) { - /* - const userProfile = await UserProfiles.findOneByOrFail({ userId: userId }); - if (!userProfile.email || !userProfile.emailNotificationTypes.includes('receiveFollowRequest')) return; - const i18n = new I18n(userProfile.lang ?? 'en-US'); - // TODO: render user information html - sendEmail(userProfile.email, i18n.t('_email._receiveFollowRequest.title'), `${follower.name} (@${Acct.toString(follower)})`, `${follower.name} (@${Acct.toString(follower)})`); - */ -} - -export const sendEmailNotification = { - follow, - receiveFollowRequest, -};