Add support for rendering media captions (#43)

* Add support for rendering media captions

* Run prettier

* Deduplicate body props

* Add basic test

* Fix import order in test

* Fix test?
This commit is contained in:
Tulir Asokan 2024-10-04 15:58:22 +02:00 committed by GitHub
parent 26b0e83ac4
commit 5fbc5af884
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 113 additions and 22 deletions

View file

@ -38,7 +38,9 @@ export function presentableTextForFile(
shortened = false,
): string {
let text = fallbackText;
if (content.body?.length) {
if (content.filename?.length) {
text = content.filename;
} else if (content.body?.length) {
// The content body should be the name of the file including a
// file extension.
text = content.body;