Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a thread visit stores only its read state #36233

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/36233/headmerged by juliusmarminge View on GitHub

Showing 6 changed files with 38 additions and 7 deletions (loading 3).

x
0 of 6 viewed, 6 left
7 additions and 5 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -3726,19 +3726,19 @@
command.searchQuery,
: null;
- // Viewing a thread changes read state only. Loading its transcript (or
- // bumping updatedAt) makes a routine read receipt scale with its history.
+ if (!movesForward && opens === null) return;
+ // Viewing a thread changes read state only. Loading its transcript, bumping
+ // updatedAt, or copying the thread into the event makes a read receipt scale with it.
yield* emit(
events,
command,
- type: "thread.visited",
+ type: "thread.visit-recorded",
threadId: command.threadId,
providerInstanceId: thread.providerInstanceId,
occurredAt,
payload: {
- ...thread,
- ...(movesForward ? { lastVisitedAt: visitedAt.value } : {}),
+ lastVisitedAt: movesForward ? visitedAt.value : thread.lastVisitedAt,
...(opens ? { opens } : {}),
@@ -14991,6 +14991,8 @@
planned.events.length > 0 ||
isUnobservedAcknowledgement(command) ||
command.type === "thread.background-work.settle" ||