1.1.3
This commit is contained in:
@@ -82,7 +82,11 @@ export const getAllReadStates = query({
|
||||
},
|
||||
});
|
||||
|
||||
// Get the latest message timestamp per channel (used by Sidebar)
|
||||
// Get the latest message timestamp per channel (used by Sidebar).
|
||||
// Also surfaces `messageId` and `senderId` so the notification
|
||||
// observer can detect genuinely new messages (not just timestamp
|
||||
// ticks from edits) and suppress notifications for the user's own
|
||||
// sends without an extra round-trip.
|
||||
export const getLatestMessageTimestamps = query({
|
||||
args: {
|
||||
channelIds: v.array(v.id("channels")),
|
||||
@@ -91,6 +95,8 @@ export const getLatestMessageTimestamps = query({
|
||||
v.object({
|
||||
channelId: v.id("channels"),
|
||||
latestTimestamp: v.number(),
|
||||
messageId: v.optional(v.id("messages")),
|
||||
senderId: v.optional(v.id("userProfiles")),
|
||||
})
|
||||
),
|
||||
handler: async (ctx, args) => {
|
||||
@@ -105,6 +111,8 @@ export const getLatestMessageTimestamps = query({
|
||||
results.push({
|
||||
channelId,
|
||||
latestTimestamp: Math.floor(latestMsg._creationTime),
|
||||
messageId: latestMsg._id,
|
||||
senderId: latestMsg.senderId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user