fix: adjust timestamp after message creation instead of passing timestamp in, #12834

This commit is contained in:
Julian Lam
2024-10-08 23:51:41 -04:00
parent 22931be1cc
commit 0346e92bb2

View File

@@ -249,7 +249,6 @@ Notes.assertPrivate = async (object) => {
if (!roomId) {
roomId = await messaging.newRoom(object.attributedTo, { uids: [...recipientsResolved] });
timestamp = Date.now(); // otherwise message can't be seen in room as it pre-dates participants joining
}
// Add any new members to the chat
@@ -266,10 +265,13 @@ Notes.assertPrivate = async (object) => {
roomId: roomId,
content: object.content,
toMid: toMid,
timestamp,
timestamp: Date.now(),
// ip: caller.ip,
});
// Set real timestamp back so that the message shows even though it predates room joining
await messaging.setMessageField(object.id, 'timestamp', timestamp);
return { roomId };
};