Soul fixes: sent-but-unechoed events count for the freshest last event; pre-aborted send starts no upload
All checks were successful
Build pull request / Build pull request (pull_request) Successful in 5m33s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Void 2026-11-13 23:17:40 +00:00
commit c98d0175ff
3 changed files with 16 additions and 5 deletions

View file

@ -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');
});
});

View file

@ -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 = {

View file

@ -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([]);