server: translate comments

This commit is contained in:
Norm 2022-12-07 15:00:02 -05:00
parent 80a73a7510
commit b23a8dbaed
3 changed files with 7 additions and 7 deletions

View file

@ -7,7 +7,7 @@ import { publishAntennaStream, publishMainStream } from '@/services/stream.js';
import { User } from '@/models/entities/user.js'; import { User } from '@/models/entities/user.js';
export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: { id: User['id']; }): Promise<void> { export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: { id: User['id']; }): Promise<void> {
// 通知しない設定になっているか、自分自身の投稿なら既読にする // If it's set to not notify the user, or if it's the user's own post, read it.
const read = !antenna.notify || (antenna.userId === noteUser.id); const read = !antenna.notify || (antenna.userId === noteUser.id);
AntennaNotes.insert({ AntennaNotes.insert({
@ -43,7 +43,7 @@ export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: {
return; return;
} }
// 2秒経っても既読にならなかったら通知 // Notify if not read after 2 seconds
setTimeout(async () => { setTimeout(async () => {
const unread = await AntennaNotes.findOneBy({ antennaId: antenna.id, read: false }); const unread = await AntennaNotes.findOneBy({ antennaId: antenna.id, read: false });
if (unread) { if (unread) {

View file

@ -24,7 +24,7 @@ export async function createNotification(
createdAt: new Date(), createdAt: new Date(),
notifieeId, notifieeId,
type, type,
// 相手がこの通知をミュートしているようなら、既読を予めつけておく // If the other party seems to have muted this notification, pre-read it.
isRead: isMuted, isRead: isMuted,
...data, ...data,
} as Partial<Notification>) } as Partial<Notification>)
@ -35,13 +35,13 @@ export async function createNotification(
// Publish notification event // Publish notification event
publishMainStream(notifieeId, 'notification', packed); publishMainStream(notifieeId, 'notification', packed);
// 2秒経っても(今回作成した)通知が既読にならなかったら「未読の通知がありますよ」イベントを発行する // If the notification (created this time) has not been read after 2 seconds, issue a "You have unread notifications" event.
setTimeout(async () => { setTimeout(async () => {
const fresh = await Notifications.findOneBy({ id: notification.id }); const fresh = await Notifications.findOneBy({ id: notification.id });
if (fresh == null) return; // 既に削除されているかもしれない if (fresh == null) return; // It may have already been deleted.
if (fresh.isRead) return; if (fresh.isRead) return;
//#region ただしミュートしているユーザーからの通知なら無視 //#region However, if the notification comes from a muted user, ignore it.
const mutings = await Mutings.findBy({ const mutings = await Mutings.findBy({
muterId: notifieeId, muterId: notifieeId,
}); });

View file

@ -7,7 +7,7 @@ export async function deleteAccount(user: {
id: string; id: string;
host: string | null; host: string | null;
}): Promise<void> { }): Promise<void> {
// 物理削除する前にDelete activityを送信する // Send Delete activity before physical deletion
await doPostSuspend(user).catch(() => {}); await doPostSuspend(user).catch(() => {});
createDeleteAccountJob(user, { createDeleteAccountJob(user, {