fix(messaging): a sent message no longer shows "Seen" instantly
Two independent defects; either alone caused it, in DMs, groups and channels. 1. useMessages reported a read of the newest NON-PENDING message regardless of author. Sending therefore made the client immediately mark its own message read, the server echoed a receipt for it, and the sender's bubble showed "Seen" before anyone had opened the thread. You do not read your own message: lastReadableId now skips your own. 2. The guard meant to catch exactly this — `e.actorId !== currentActorId` — could never fire: the receipt carries the reader's IIOS actor UUID while clients hold a userId, so the comparison was always true and every receipt, including your own, counted as the other side. The gateway now also emits userId on READ and DELIVERED receipts (matching what `annotation` already did), and ReceiptEvent carries it as optional so older servers still typecheck. MockAdapter.markRead was a no-op, so it could not exercise any of this; it now echoes a receipt like a real server. Regression test verified to fail without the fix. SDK 0.1.14; suite 17 files / 101 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,11 @@ export interface OpenThreadResult {
|
||||
|
||||
export interface ReceiptEvent {
|
||||
interactionId: string;
|
||||
/** The reader's IIOS actor UUID — an internal id, NOT comparable to a caller's userId. */
|
||||
actorId: string;
|
||||
/** The reader's userId — the same id space clients hold, so they can ignore their own receipt.
|
||||
* Optional: absent from servers older than the change that added it. */
|
||||
userId?: string;
|
||||
kind: 'READ' | 'DELIVERED';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user