Handle nested quotes same as prod

This commit is contained in:
Eric Bailey
2025-06-12 10:11:32 -05:00
parent 297b0e93e5
commit dbebb48043
2 changed files with 23 additions and 4 deletions
+19 -1
View File
@@ -149,6 +149,10 @@ function RecordEmbed({
return null
}
case 'post': {
if (rest.isWithinQuote && !rest.allowNestedQuotes) {
return null
}
return (
<QuoteEmbed
{...rest}
@@ -158,6 +162,8 @@ function RecordEmbed({
? QuoteEmbedViewContext.FeedEmbedRecordWithMedia
: undefined
}
isWithinQuote={rest.isWithinQuote}
allowNestedQuotes={rest.allowNestedQuotes}
/>
)
}
@@ -213,6 +219,8 @@ export function QuoteEmbed({
embed,
onOpen,
style,
isWithinQuote: parentIsWithinQuote,
allowNestedQuotes: parentAllowNestedQuotes,
}: Omit<CommonProps, 'viewContext'> & {
embed: EmbedType<'post'>
viewContext?: QuoteEmbedViewContext
@@ -306,7 +314,17 @@ export function QuoteEmbed({
disableLinks
/>
) : null}
{quote.embed && <Embed embed={quote.embed} moderation={moderation} />}
{quote.embed && (
<Embed
embed={quote.embed}
moderation={moderation}
isWithinQuote={parentIsWithinQuote ?? true}
// already within quote? override nested
allowNestedQuotes={
parentIsWithinQuote ? false : parentAllowNestedQuotes
}
/>
)}
</Link>
</ContentHider>
</View>
+4 -3
View File
@@ -1,5 +1,5 @@
import {StyleProp, ViewStyle} from 'react-native'
import {AppBskyFeedDefs, ModerationDecision} from '@atproto/api'
import {type StyleProp, type ViewStyle} from 'react-native'
import {type AppBskyFeedDefs, type ModerationDecision} from '@atproto/api'
export enum PostEmbedViewContext {
ThreadHighlighted = 'ThreadHighlighted',
@@ -15,8 +15,9 @@ export type CommonProps = {
moderation?: ModerationDecision
onOpen?: () => void
style?: StyleProp<ViewStyle>
allowNestedQuotes?: boolean
viewContext?: PostEmbedViewContext
isWithinQuote?: boolean
allowNestedQuotes?: boolean
}
export type EmbedProps = CommonProps & {