fix: Bug - Sending files and attachment issues

Hydrate playable media after disk receive, relay file-announce to sibling
devices via account_sync, bind DM attachments to pre-allocated message ids,
and improve gallery retry/cancel UX with bounded parallel auto-downloads.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-14 13:05:23 +02:00
co-authored by Cursor
parent bb0ac930ad
commit fa45052432
30 changed files with 785 additions and 71 deletions
@@ -0,0 +1,30 @@
import { planDmMessageSend } from './dm-message-send.rules';
function makeFile(name: string): File {
return new File(['x'], name, { type: 'image/png' });
}
describe('planDmMessageSend', () => {
it('binds attachments to the same pre-allocated message id', () => {
const generateId = () => 'dm-msg-1';
const plan = planDmMessageSend({
generateId,
content: 'hello',
pendingFiles: [makeFile('a.png'), makeFile('b.png')]
});
expect(plan.action.id).toBe('dm-msg-1');
expect(plan.attachmentBinding?.messageId).toBe('dm-msg-1');
expect(plan.attachmentBinding?.files).toHaveLength(2);
});
it('returns no attachment binding when there are no pending files', () => {
const plan = planDmMessageSend({
generateId: () => 'dm-msg-2',
content: 'text only',
pendingFiles: []
});
expect(plan.attachmentBinding).toBeNull();
});
});