Support for single-attachment delete synced across devices

This commit is contained in:
Scott Nonnenberg 2024-06-21 15:35:18 -07:00 committed by GitHub
parent 97229e2e65
commit ac04d02d4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 422 additions and 55 deletions

View file

@ -1,6 +1,8 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { v4 as generateUuid } from 'uuid';
import type {
AttachmentType,
AttachmentDraftType,
@ -33,6 +35,7 @@ export const fakeDraftAttachment = (
overrides: Partial<AttachmentDraftType> = {}
): AttachmentDraftType => ({
pending: false,
clientUuid: generateUuid(),
contentType: IMAGE_JPEG,
path: 'file.jpg',
size: 10304,

View file

@ -3,6 +3,7 @@
import { assert } from 'chai';
import Long from 'long';
import { v4 as generateUuid } from 'uuid';
import {
processDataMessage,
@ -12,14 +13,17 @@ import type { ProcessedAttachment } from '../textsecure/Types.d';
import { SignalService as Proto } from '../protobuf';
import { IMAGE_GIF, IMAGE_JPEG } from '../types/MIME';
import { generateAci } from '../types/ServiceId';
import { uuidToBytes } from '../util/uuidToBytes';
const ACI_1 = generateAci();
const FLAGS = Proto.DataMessage.Flags;
const TIMESTAMP = Date.now();
const CLIENT_UUID = generateUuid();
const UNPROCESSED_ATTACHMENT: Proto.IAttachmentPointer = {
cdnId: Long.fromNumber(123),
clientUuid: uuidToBytes(CLIENT_UUID),
key: new Uint8Array([1, 2, 3]),
digest: new Uint8Array([4, 5, 6]),
contentType: IMAGE_GIF,
@ -28,6 +32,7 @@ const UNPROCESSED_ATTACHMENT: Proto.IAttachmentPointer = {
const PROCESSED_ATTACHMENT: ProcessedAttachment = {
cdnId: '123',
clientUuid: CLIENT_UUID,
key: 'AQID',
digest: 'BAUG',
contentType: IMAGE_GIF,

View file

@ -4,6 +4,7 @@
import { assert } from 'chai';
import * as sinon from 'sinon';
import { noop } from 'lodash';
import { v4 as generateUuid } from 'uuid';
import type { ReduxActions } from '../../../state/types';
import {
@ -68,6 +69,7 @@ describe('both/state/ducks/composer', () => {
const attachments: Array<AttachmentDraftType> = [
{
contentType: IMAGE_JPEG,
clientUuid: generateUuid(),
pending: true,
size: 2433,
path: 'image.jpg',