From 486be564e81b0e113b4746b220aebfdfe5730726 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sat, 12 Nov 2022 17:39:36 +0100 Subject: [PATCH] server: improve comments --- packages/backend/src/services/push-notification.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/services/push-notification.ts b/packages/backend/src/services/push-notification.ts index 56a8c83bf..5f1e30982 100644 --- a/packages/backend/src/services/push-notification.ts +++ b/packages/backend/src/services/push-notification.ts @@ -15,20 +15,21 @@ type pushNotificationsTypes = { 'readAllMessagingMessagesOfARoom': { userId: string } | { groupId: string }; }; -// プッシュメッセージサーバーには文字数制限があるため、内容を削減します +// Reduce the content of the push message because of the character limit function truncateNotification(notification: Packed<'Notification'>): any { if (notification.note) { return { ...notification, note: { ...notification.note, - // textをgetNoteSummaryしたものに置き換える + // replace text with getNoteSummary text: getNoteSummary(notification.type === 'renote' ? notification.note.renote as Packed<'Note'> : notification.note), cw: undefined, reply: undefined, renote: undefined, - user: undefined as any, // 通知を受け取ったユーザーである場合が多いのでこれも捨てる + // unnecessary, since usually the user who is receiving the notification knows who they are + user: undefined as any, }, }; } @@ -41,7 +42,7 @@ export async function pushNotification(u if (!meta.enableServiceWorker || meta.swPublicKey == null || meta.swPrivateKey == null) return; - // アプリケーションの連絡先と、サーバーサイドの鍵ペアの情報を登録 + // Register key pair information push.setVapidDetails(config.url, meta.swPublicKey, meta.swPrivateKey); @@ -65,10 +66,6 @@ export async function pushNotification(u }), { proxy: config.proxy, }).catch((err: any) => { - //swLogger.info(err.statusCode); - //swLogger.info(err.headers); - //swLogger.info(err.body); - if (err.statusCode === 410) { SwSubscriptions.delete({ userId,