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} /> <VideoItem thumbnail={e.view.thumbnail} alt={e.view.alt} />
</Outer> </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 return null
+12 -11
View File
@@ -1,4 +1,5 @@
import { import {
$Typed,
AppBskyEmbedExternal, AppBskyEmbedExternal,
AppBskyEmbedImages, AppBskyEmbedImages,
AppBskyEmbedRecord, AppBskyEmbedRecord,
@@ -12,47 +13,47 @@ import {
export type Embed = export type Embed =
| { | {
type: 'post' type: 'post'
view: AppBskyEmbedRecord.ViewRecord view: $Typed<AppBskyEmbedRecord.ViewRecord>
} }
| { | {
type: 'post_not_found' type: 'post_not_found'
view: AppBskyEmbedRecord.ViewNotFound view: $Typed<AppBskyEmbedRecord.ViewNotFound>
} }
| { | {
type: 'post_blocked' type: 'post_blocked'
view: AppBskyEmbedRecord.ViewBlocked view: $Typed<AppBskyEmbedRecord.ViewBlocked>
} }
| { | {
type: 'post_detached' type: 'post_detached'
view: AppBskyEmbedRecord.ViewDetached view: $Typed<AppBskyEmbedRecord.ViewDetached>
} }
| { | {
type: 'feed' type: 'feed'
view: AppBskyFeedDefs.GeneratorView view: $Typed<AppBskyFeedDefs.GeneratorView>
} }
| { | {
type: 'list' type: 'list'
view: AppBskyGraphDefs.ListView view: $Typed<AppBskyGraphDefs.ListView>
} }
| { | {
type: 'labeler' type: 'labeler'
view: AppBskyLabelerDefs.LabelerView view: $Typed<AppBskyLabelerDefs.LabelerView>
} }
| { | {
type: 'starter_pack' type: 'starter_pack'
view: AppBskyGraphDefs.StarterPackViewBasic view: $Typed<AppBskyGraphDefs.StarterPackViewBasic>
} }
| { | {
type: 'images' type: 'images'
view: AppBskyEmbedImages.View view: $Typed<AppBskyEmbedImages.View>
} }
| { | {
type: 'link' type: 'link'
view: AppBskyEmbedExternal.View view: $Typed<AppBskyEmbedExternal.View>
} }
| { | {
type: 'video' type: 'video'
view: AppBskyEmbedVideo.View view: $Typed<AppBskyEmbedVideo.View>
} }
| { | {
type: 'post_with_media' type: 'post_with_media'