( state: UiState, threadId: string, latestTurnCompletedAt: string | null | undefined, )
| 250 | } |
| 251 | |
| 252 | export function markThreadUnread( |
| 253 | state: UiState, |
| 254 | threadId: string, |
| 255 | latestTurnCompletedAt: string | null | undefined, |
| 256 | ): UiState { |
| 257 | if (!latestTurnCompletedAt) { |
| 258 | return state; |
| 259 | } |
| 260 | const latestTurnCompletedAtMs = Date.parse(latestTurnCompletedAt); |
| 261 | if (Number.isNaN(latestTurnCompletedAtMs)) { |
| 262 | return state; |
| 263 | } |
| 264 | const unreadVisitedAt = new Date(latestTurnCompletedAtMs - 1).toISOString(); |
| 265 | if (state.threadLastVisitedAtById[threadId] === unreadVisitedAt) { |
| 266 | return state; |
| 267 | } |
| 268 | return { |
| 269 | ...state, |
| 270 | threadLastVisitedAtById: { |
| 271 | ...state.threadLastVisitedAtById, |
| 272 | [threadId]: unreadVisitedAt, |
| 273 | }, |
| 274 | }; |
| 275 | } |
| 276 | |
| 277 | export function setThreadChangedFilesExpanded( |
| 278 | state: UiState, |
no outgoing calls
no test coverage detected