Fix missing RecordWithMedia media embed preview in notifications view (#7988)

This commit is contained in:
Eric Bailey
2025-03-14 10:28:02 -05:00
committed by GitHub
parent dcc8b35146
commit 9cea7f0393
2 changed files with 20 additions and 11 deletions
+8
View File
@@ -54,6 +54,14 @@ export function Embed({
<VideoItem thumbnail={e.view.thumbnail} alt={e.view.alt} />
</Outer>
)
} else if (
e.type === 'post_with_media' &&
// ignore further "nested" RecordWithMedia
e.media.type !== 'post_with_media' &&
// ignore any unknowns
e.media.view !== null
) {
return <Embed embed={e.media.view} style={style} />
}
return null
+12 -11
View File
@@ -1,4 +1,5 @@
import {
$Typed,
AppBskyEmbedExternal,
AppBskyEmbedImages,
AppBskyEmbedRecord,
@@ -12,47 +13,47 @@ import {
export type Embed =
| {
type: 'post'
view: AppBskyEmbedRecord.ViewRecord
view: $Typed<AppBskyEmbedRecord.ViewRecord>
}
| {
type: 'post_not_found'
view: AppBskyEmbedRecord.ViewNotFound
view: $Typed<AppBskyEmbedRecord.ViewNotFound>
}
| {
type: 'post_blocked'
view: AppBskyEmbedRecord.ViewBlocked
view: $Typed<AppBskyEmbedRecord.ViewBlocked>
}
| {
type: 'post_detached'
view: AppBskyEmbedRecord.ViewDetached
view: $Typed<AppBskyEmbedRecord.ViewDetached>
}
| {
type: 'feed'
view: AppBskyFeedDefs.GeneratorView
view: $Typed<AppBskyFeedDefs.GeneratorView>
}
| {
type: 'list'
view: AppBskyGraphDefs.ListView
view: $Typed<AppBskyGraphDefs.ListView>
}
| {
type: 'labeler'
view: AppBskyLabelerDefs.LabelerView
view: $Typed<AppBskyLabelerDefs.LabelerView>
}
| {
type: 'starter_pack'
view: AppBskyGraphDefs.StarterPackViewBasic
view: $Typed<AppBskyGraphDefs.StarterPackViewBasic>
}
| {
type: 'images'
view: AppBskyEmbedImages.View
view: $Typed<AppBskyEmbedImages.View>
}
| {
type: 'link'
view: AppBskyEmbedExternal.View
view: $Typed<AppBskyEmbedExternal.View>
}
| {
type: 'video'
view: AppBskyEmbedVideo.View
view: $Typed<AppBskyEmbedVideo.View>
}
| {
type: 'post_with_media'