From c98d0175ff2af6e3c9f2c035b28c88551bc67eb5 Mon Sep 17 00:00:00 2001 From: Void Date: Fri, 13 Nov 2026 23:17:40 +0000 Subject: [PATCH] Soul fixes: sent-but-unechoed events count for the freshest last event; pre-aborted send starts no upload Co-Authored-By: Claude Sonnet 5.5 --- src/app/features/albums/ShareSet.folder.test.tsx | 6 ++++-- src/app/features/albums/ShareSet.tsx | 4 ++-- src/app/features/albums/shareSet.test.ts | 11 ++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/app/features/albums/ShareSet.folder.test.tsx b/src/app/features/albums/ShareSet.folder.test.tsx index 109d538c..f4ec40f5 100644 --- a/src/app/features/albums/ShareSet.folder.test.tsx +++ b/src/app/features/albums/ShareSet.folder.test.tsx @@ -104,9 +104,11 @@ describe('ShareSet: the folder reaches the album title', () => { timeline.push( ev('$other', 99, '$else'), ev('$local', 98, '$alb', 'sending'), - ev('$new', 50, '$alb') + ev('$new', 50, '$alb'), + ev('$sentNotEchoed', 60, '$alb', 'sent'), + ev('$failed', 70, '$alb', 'not_sent') ); mount(['a'], { albumId: '$alb', lastId: '$last', lastTs: 5 }); - expect(await send('x')).toBe('into:$alb@$new'); + expect(await send('x')).toBe('into:$alb@$sentNotEchoed'); }); }); diff --git a/src/app/features/albums/ShareSet.tsx b/src/app/features/albums/ShareSet.tsx index 6bce53c7..a7f2f783 100644 --- a/src/app/features/albums/ShareSet.tsx +++ b/src/app/features/albums/ShareSet.tsx @@ -1,7 +1,7 @@ import React, { useRef, useState, useSyncExternalStore } from 'react'; import { Text } from 'folds'; import { useQueryClient } from '@tanstack/react-query'; -import { Room } from 'matrix-js-sdk'; +import { EventStatus, Room } from 'matrix-js-sdk'; import { useMatrixClient } from '../../hooks/useMatrixClient'; import { useClientConfig } from '../../hooks/useClientConfig'; import { uploadContent } from '../../utils/matrix'; @@ -118,7 +118,7 @@ const threadEvents = (room: Room): ThreadEvent[] => room .getLiveTimeline() .getEvents() - .filter((e) => !e.status && !!e.getId()) + .filter((e) => (!e.status || e.status === EventStatus.SENT) && !!e.getId()) .map((e) => ({ id: e.getId() as string, ts: e.getTs(), threadRoot: e.threadRootId })); type ShareSetProps = { diff --git a/src/app/features/albums/shareSet.test.ts b/src/app/features/albums/shareSet.test.ts index a78cf93c..3fd85700 100644 --- a/src/app/features/albums/shareSet.test.ts +++ b/src/app/features/albums/shareSet.test.ts @@ -263,11 +263,20 @@ describe('stopping a send', () => { const r = room(); const ac = new AbortController(); ac.abort(); + let uploads = 0; const res = await sendShareSet( - { ...r.port, signal: ac.signal }, + { + ...r.port, + signal: ac.signal, + contentOf: async (f) => { + uploads += 1; + return r.port.contentOf(f); + }, + }, { albumId: '$a', lastId: '$l', lastTs: 1 }, clips ); + expect(uploads).toBe(0); expect(res.sent).toBe(0); expect(res.failedAt).toEqual([0, 1, 2]); expect(r.events).toEqual([]);