mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: adjust timestamp after message creation instead of passing timestamp in, #12834
This commit is contained in:
@@ -249,7 +249,6 @@ Notes.assertPrivate = async (object) => {
|
|||||||
|
|
||||||
if (!roomId) {
|
if (!roomId) {
|
||||||
roomId = await messaging.newRoom(object.attributedTo, { uids: [...recipientsResolved] });
|
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
|
// Add any new members to the chat
|
||||||
@@ -266,10 +265,13 @@ Notes.assertPrivate = async (object) => {
|
|||||||
roomId: roomId,
|
roomId: roomId,
|
||||||
content: object.content,
|
content: object.content,
|
||||||
toMid: toMid,
|
toMid: toMid,
|
||||||
timestamp,
|
timestamp: Date.now(),
|
||||||
// ip: caller.ip,
|
// 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 };
|
return { roomId };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user