diff --git a/app/javascript/flavours/glitch/components/status_quoted.tsx b/app/javascript/flavours/glitch/components/status_quoted.tsx index 6d845119ab..f2301ab36b 100644 --- a/app/javascript/flavours/glitch/components/status_quoted.tsx +++ b/app/javascript/flavours/glitch/components/status_quoted.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo, useRef } from 'react'; +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { FormattedMessage } from 'react-intl'; @@ -83,6 +83,62 @@ const LimitedAccountHint: React.FC<{ accountId: string }> = ({ accountId }) => { ); }; +const FilteredQuote: React.FC<{ + reveal: VoidFunction; + quotedAccountId: string; + quoteState: string; +}> = ({ reveal, quotedAccountId, quoteState }) => { + const account = useAppSelector((state) => + quotedAccountId ? state.accounts.get(quotedAccountId) : undefined, + ); + + const quoteAuthorName = account?.acct; + const domain = quoteAuthorName?.split('@')[1]; + + let message; + + switch (quoteState) { + case 'blocked_account': + message = ( + + ); + break; + case 'blocked_domain': + message = ( + + ); + break; + case 'muted_account': + message = ( + + ); + } + + return ( + <> + {message} + + + ); +}; + interface QuotedStatusProps { quote: QuoteMap; contextType?: string; @@ -130,6 +186,11 @@ export const QuotedStatus: React.FC = ({ const isLoaded = loadingState === 'complete'; const isFetchingQuoteRef = useRef(false); + const [revealed, setRevealed] = useState(false); + + const reveal = useCallback(() => { + setRevealed(true); + }, [setRevealed]); useEffect(() => { if (isLoaded) { @@ -189,6 +250,20 @@ export const QuotedStatus: React.FC = ({ defaultMessage='Post removed by author' /> ); + } else if ( + (quoteState === 'blocked_account' || + quoteState === 'blocked_domain' || + quoteState === 'muted_account') && + !revealed && + accountId + ) { + quoteError = ( + + ); } else if ( !status || !quotedStatusId ||