Skip to content

Node.js based forum software built for the modern web

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

Julian Lam0346e92bb2e1
diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js
index 92537c036f..8b77491814 100644
--- a/src/activitypub/notes.js
+++ b/src/activitypub/notes.js
@@ -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 };
};