fix (backend): make sure to use the exact same time for id and createdAt

This commit is contained in:
naskya 2024-05-29 19:14:00 +09:00 committed by Eana Hufwe
parent def565af9b
commit db4e0e931b

View file

@ -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,
// 相手がこの通知をミュートしているようなら、既読を予めつけておく