Normalize message attachments

This commit is contained in:
trevor-signal
2025-05-22 21:09:54 -04:00
committed by GitHub
parent 8d8e0329cf
commit d6e81eee11
39 changed files with 2540 additions and 807 deletions

View File

@@ -913,6 +913,7 @@ export function MixedContentTypes(args: Props): JSX.Element {
screenshot: {
height: 112,
width: 112,
size: 128000,
url: '/fixtures/kitten-4-112-112.jpg',
contentType: IMAGE_JPEG,
path: 'originalpath',

View File

@@ -244,7 +244,7 @@ ImageOnly.args = {
width: 100,
size: 100,
path: pngUrl,
objectUrl: pngUrl,
url: pngUrl,
},
},
};
@@ -261,7 +261,7 @@ ImageAttachment.args = {
width: 100,
size: 100,
path: pngUrl,
objectUrl: pngUrl,
url: pngUrl,
},
},
};
@@ -331,7 +331,7 @@ VideoOnly.args = {
width: 100,
size: 100,
path: pngUrl,
objectUrl: pngUrl,
url: pngUrl,
},
},
text: undefined,
@@ -349,7 +349,7 @@ VideoAttachment.args = {
width: 100,
size: 100,
path: pngUrl,
objectUrl: pngUrl,
url: pngUrl,
},
},
};
@@ -588,7 +588,7 @@ IsStoryReplyEmoji.args = {
width: 100,
size: 100,
path: pngUrl,
objectUrl: pngUrl,
url: pngUrl,
},
},
reactionEmoji: '🏋️',

View File

@@ -33,7 +33,10 @@ import type { QuotedAttachmentType } from '../../model-types';
const EMPTY_OBJECT = Object.freeze(Object.create(null));
export type QuotedAttachmentForUIType = QuotedAttachmentType &
export type QuotedAttachmentForUIType = Pick<
QuotedAttachmentType,
'contentType' | 'thumbnail' | 'fileName'
> &
Pick<AttachmentType, 'isVoiceMessage' | 'fileName' | 'textAttachment'>;
export type Props = {
@@ -101,7 +104,7 @@ function getUrl(thumbnail?: ThumbnailType): string | undefined {
return;
}
return thumbnail.objectUrl || thumbnail.url;
return thumbnail.url;
}
function getTypeLabel({