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 return null
} }
case 'post': { case 'post': {
if (rest.isWithinQuote && !rest.allowNestedQuotes) {
return null
}
return ( return (
<QuoteEmbed <QuoteEmbed
{...rest} {...rest}
@@ -158,6 +162,8 @@ function RecordEmbed({
? QuoteEmbedViewContext.FeedEmbedRecordWithMedia ? QuoteEmbedViewContext.FeedEmbedRecordWithMedia
: undefined : undefined
} }
isWithinQuote={rest.isWithinQuote}
allowNestedQuotes={rest.allowNestedQuotes}
/> />
) )
} }
@@ -213,6 +219,8 @@ export function QuoteEmbed({
embed, embed,
onOpen, onOpen,
style, style,
isWithinQuote: parentIsWithinQuote,
allowNestedQuotes: parentAllowNestedQuotes,
}: Omit<CommonProps, 'viewContext'> & { }: Omit<CommonProps, 'viewContext'> & {
embed: EmbedType<'post'> embed: EmbedType<'post'>
viewContext?: QuoteEmbedViewContext viewContext?: QuoteEmbedViewContext
@@ -306,7 +314,17 @@ export function QuoteEmbed({
disableLinks disableLinks
/> />
) : null} ) : 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> </Link>
</ContentHider> </ContentHider>
</View> </View>
+4 -3
View File
@@ -1,5 +1,5 @@
import {StyleProp, ViewStyle} from 'react-native' import {type StyleProp, type ViewStyle} from 'react-native'
import {AppBskyFeedDefs, ModerationDecision} from '@atproto/api' import {type AppBskyFeedDefs, type ModerationDecision} from '@atproto/api'
export enum PostEmbedViewContext { export enum PostEmbedViewContext {
ThreadHighlighted = 'ThreadHighlighted', ThreadHighlighted = 'ThreadHighlighted',
@@ -15,8 +15,9 @@ export type CommonProps = {
moderation?: ModerationDecision moderation?: ModerationDecision
onOpen?: () => void onOpen?: () => void
style?: StyleProp<ViewStyle> style?: StyleProp<ViewStyle>
allowNestedQuotes?: boolean
viewContext?: PostEmbedViewContext viewContext?: PostEmbedViewContext
isWithinQuote?: boolean
allowNestedQuotes?: boolean
} }
export type EmbedProps = CommonProps & { export type EmbedProps = CommonProps & {