fix: Allow quotes to be filtered (#34786)

This commit is contained in:
diondiondion 2025-05-23 13:42:55 +02:00 committed by GitHub
parent 229e100dc0
commit 68a5724b3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -68,15 +68,15 @@ type QuoteMap = ImmutableMap<'state' | 'quoted_status', string | null>;
export const QuotedStatus: React.FC<{ export const QuotedStatus: React.FC<{
quote: QuoteMap; quote: QuoteMap;
contextType?: string;
variant?: 'full' | 'link'; variant?: 'full' | 'link';
nestingLevel?: number; nestingLevel?: number;
}> = ({ quote, nestingLevel = 1, variant = 'full' }) => { }> = ({ quote, contextType, nestingLevel = 1, variant = 'full' }) => {
const quotedStatusId = quote.get('quoted_status'); const quotedStatusId = quote.get('quoted_status');
const state = quote.get('state'); const state = quote.get('state');
const status = useAppSelector((state) => const status = useAppSelector((state) =>
quotedStatusId ? state.statuses.get(quotedStatusId) : undefined, quotedStatusId ? state.statuses.get(quotedStatusId) : undefined,
); );
let quoteError: React.ReactNode = null; let quoteError: React.ReactNode = null;
if (state === 'deleted') { if (state === 'deleted') {
@ -131,10 +131,16 @@ export const QuotedStatus: React.FC<{
return ( return (
<QuoteWrapper> <QuoteWrapper>
{/* @ts-expect-error Status is not yet typed */} {/* @ts-expect-error Status is not yet typed */}
<StatusContainer isQuotedPost id={quotedStatusId} avatarSize={40}> <StatusContainer
isQuotedPost
id={quotedStatusId}
contextType={contextType}
avatarSize={40}
>
{canRenderChildQuote && ( {canRenderChildQuote && (
<QuotedStatus <QuotedStatus
quote={childQuote} quote={childQuote}
contextType={contextType}
variant={ variant={
nestingLevel === MAX_QUOTE_POSTS_NESTING_LEVEL ? 'link' : 'full' nestingLevel === MAX_QUOTE_POSTS_NESTING_LEVEL ? 'link' : 'full'
} }
@ -148,6 +154,7 @@ export const QuotedStatus: React.FC<{
interface StatusQuoteManagerProps { interface StatusQuoteManagerProps {
id: string; id: string;
contextType?: string;
[key: string]: unknown; [key: string]: unknown;
} }
@ -168,7 +175,7 @@ export const StatusQuoteManager = (props: StatusQuoteManagerProps) => {
if (quote) { if (quote) {
return ( return (
<StatusContainer {...props}> <StatusContainer {...props}>
<QuotedStatus quote={quote} /> <QuotedStatus quote={quote} contextType={props.contextType} />
</StatusContainer> </StatusContainer>
); );
} }