mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 21:37:34 -07:00
Improve email notification
This commit is contained in:
parent
65a9f96070
commit
29698850d9
1 changed files with 4 additions and 2 deletions
|
@ -3,15 +3,17 @@ import { User } from '../models/entities/user';
|
||||||
import { sendEmail } from './send-email';
|
import { sendEmail } from './send-email';
|
||||||
import * as locales from '../../locales/';
|
import * as locales from '../../locales/';
|
||||||
import { I18n } from '@/misc/i18n';
|
import { I18n } from '@/misc/i18n';
|
||||||
|
import acct from '@/misc/acct/render';
|
||||||
|
|
||||||
// TODO: locale ファイルをクライアント用とサーバー用で分けたい
|
// TODO: locale ファイルをクライアント用とサーバー用で分けたい
|
||||||
|
|
||||||
async function follow(userId: User['id'], args: {}) {
|
async function follow(userId: User['id'], follower: User) {
|
||||||
const userProfile = await UserProfiles.findOneOrFail({ userId: userId });
|
const userProfile = await UserProfiles.findOneOrFail({ userId: userId });
|
||||||
if (!userProfile.email || !userProfile.emailNotificationTypes.includes('follow')) return;
|
if (!userProfile.email || !userProfile.emailNotificationTypes.includes('follow')) return;
|
||||||
const locale = locales[userProfile.lang || 'ja-JP'];
|
const locale = locales[userProfile.lang || 'ja-JP'];
|
||||||
const i18n = new I18n(locale);
|
const i18n = new I18n(locale);
|
||||||
sendEmail(userProfile.email, i18n.t('_email._follow.title'), 'test', 'test');
|
// TODO: render user information html
|
||||||
|
sendEmail(userProfile.email, i18n.t('_email._follow.title'), `${follower.name} (@${acct(follower)})`, `${follower.name} (@${acct(follower)})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function receiveFollowRequest(userId: User['id'], args: {}) {
|
async function receiveFollowRequest(userId: User['id'], args: {}) {
|
||||||
|
|
Loading…
Reference in a new issue