From db4e0e931bfaab5822c99ac36c4dd9173f9e2394 Mon Sep 17 00:00:00 2001 From: naskya Date: Wed, 29 May 2024 19:14:00 +0900 Subject: [PATCH] fix (backend): make sure to use the exact same time for id and createdAt --- packages/backend/src/services/create-notification.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/services/create-notification.ts b/packages/backend/src/services/create-notification.ts index fa86d2dec6..7e338eb614 100644 --- a/packages/backend/src/services/create-notification.ts +++ b/packages/backend/src/services/create-notification.ts @@ -8,7 +8,7 @@ import { Followings, } from "@/models/index.js"; import { - genId, + genIdAt, isSilencedServer, sendPushNotification, PushNotificationKind, @@ -63,9 +63,10 @@ export async function createNotification( } // Create notification + const createdAt = new Date(); const notification = await Notifications.insert({ - id: genId(), - createdAt: new Date(), + id: genIdAt(createdAt), + createdAt, notifieeId: notifieeId, type: type, // 相手がこの通知をミュートしているようなら、既読を予めつけておく