File zone: the readers hook rescans on redaction and reset; replies guard is one local; reader order by time
All checks were successful
Build pull request / Build pull request (pull_request) Successful in 3m26s

Soul findings 1, 2 (doc), 4 and the merge order.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Void 2026-11-11 22:34:39 +00:00
commit da2445044d
4 changed files with 12 additions and 5 deletions

View file

@ -90,6 +90,8 @@ what the hash and the Mind's own account show.
- Files sent from the composer carry no thread relation, so they reach an album only if written into a
thread by another tool; the album upload path (docs/file-zone.md, "Upload") is unwritten. Their receipts are plain
room events, and the timeline row for the file shows `read by` from them.
- A receipt that is still encrypted when it arrives is not seen until a later timeline event triggers a rescan; zones are
unencrypted and the hash is written only there, so this is the encrypted-room limit again.
- The timeline row reads the room's loaded timeline only: a receipt older than what the client has paged in is not
seen there (an album's own listing reads the thread, which is paged separately).
- Encrypted zones are not listed.

View file

@ -16,7 +16,9 @@ type FileReadByProps = {
/** "read by <Mind>" under a file: the Minds whose verified receipts are in the room's timeline. Nothing when none. */
export function FileReadBy({ room, fileId, content, also = [] }: FileReadByProps) {
const seen = useFileReaders(room, fileId, content);
const readers = [...new Map([...also, ...seen].map((r) => [r.sender, r])).values()];
const readers = [...new Map([...also, ...seen].map((r) => [r.sender, r])).values()].sort(
(a, b) => a.ts - b.ts
);
if (readers.length === 0) return null;
return (
<Text size="T200" className={css.Dim}>

View file

@ -93,7 +93,8 @@ const toAlbum = (input: AlbumInput, server: string): Album | undefined => {
const { root, replies } = input ?? {};
if (!live(root)) return undefined;
const seen = new Set<string>();
const files = (Array.isArray(replies) ? replies : [])
const list = Array.isArray(replies) ? replies : [];
const files = list
.map(toFile)
.filter((f): f is AlbumFile => {
if (!f || seen.has(f.id)) return false;
@ -101,7 +102,7 @@ const toAlbum = (input: AlbumInput, server: string): Album | undefined => {
return true;
})
.sort((a, b) => a.ts - b.ts)
.map((f) => ({ ...f, readBy: readersOf(replies, f.id, f.content, server) }));
.map((f) => ({ ...f, readBy: readersOf(list, f.id, f.content, server) }));
return {
id: root.event_id,
title: titleOf(root),

View file

@ -41,9 +41,11 @@ export const useFileReaders = (
);
};
scan();
room.on(RoomEvent.Timeline, scan);
// A redaction removes a tick and a reset drops the window: both rescan, not only a new event.
const events = [RoomEvent.Timeline, RoomEvent.Redaction, RoomEvent.TimelineReset] as const;
events.forEach((ev) => room.on(ev, scan));
return () => {
room.off(RoomEvent.Timeline, scan);
events.forEach((ev) => room.off(ev, scan));
};
}, [room, fileId, content, server]);
return readers;