mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-17 23:34:14 +01:00
Improve export handling of body ranges and storyReactions
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
@@ -28,6 +28,7 @@ import { IMAGE_PNG, TEXT_ATTACHMENT } from '../../types/MIME.std.js';
|
||||
import { MY_STORY_ID } from '../../types/Stories.std.js';
|
||||
import { generateAttachmentKeys } from '../../AttachmentCrypto.node.js';
|
||||
import { itemStorage } from '../../textsecure/Storage.preload.js';
|
||||
import { BodyRange } from '../../types/BodyRange.std.js';
|
||||
|
||||
const CONTACT_A = generateAci();
|
||||
const CONTACT_B = generateAci();
|
||||
@@ -607,7 +608,7 @@ describe('backup/bubble messages', () => {
|
||||
await asymmetricRoundtripHarness(
|
||||
[
|
||||
{
|
||||
conversationId: gv1.id,
|
||||
conversationId: contactA.id,
|
||||
id: generateGuid(),
|
||||
type: 'incoming',
|
||||
received_at: 3,
|
||||
@@ -625,6 +626,62 @@ describe('backup/bubble messages', () => {
|
||||
[]
|
||||
);
|
||||
});
|
||||
it('drops invalid body ranges', async () => {
|
||||
await asymmetricRoundtripHarness(
|
||||
[
|
||||
{
|
||||
conversationId: contactA.id,
|
||||
id: generateGuid(),
|
||||
type: 'incoming',
|
||||
received_at: 3,
|
||||
received_at_ms: 3,
|
||||
sent_at: 3,
|
||||
timestamp: 3,
|
||||
sourceServiceId: CONTACT_A,
|
||||
body: 'd',
|
||||
bodyRanges: [
|
||||
{
|
||||
start: 0,
|
||||
length: 1,
|
||||
// @ts-expect-error invalid data
|
||||
style: undefined,
|
||||
},
|
||||
{
|
||||
start: 1,
|
||||
length: 0,
|
||||
style: BodyRange.Style.BOLD,
|
||||
},
|
||||
],
|
||||
readStatus: ReadStatus.Unread,
|
||||
seenStatus: SeenStatus.Unseen,
|
||||
unidentifiedDeliveryReceived: true,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
conversationId: contactA.id,
|
||||
id: generateGuid(),
|
||||
type: 'incoming',
|
||||
received_at: 3,
|
||||
received_at_ms: 3,
|
||||
sent_at: 3,
|
||||
timestamp: 3,
|
||||
sourceServiceId: CONTACT_A,
|
||||
body: 'd',
|
||||
bodyRanges: [
|
||||
{
|
||||
start: 1,
|
||||
length: 0,
|
||||
style: BodyRange.Style.BOLD,
|
||||
},
|
||||
],
|
||||
readStatus: ReadStatus.Unread,
|
||||
seenStatus: SeenStatus.Unseen,
|
||||
unidentifiedDeliveryReceived: true,
|
||||
},
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
it('drops messages that expire soon', async () => {
|
||||
await asymmetricRoundtripHarness(
|
||||
|
||||
Reference in New Issue
Block a user