Composer quote improvements (#35835)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Co-authored-by: diondiondion <mail@diondiondion.com>
This commit is contained in:
Echo 2025-08-21 16:07:31 +02:00 committed by GitHub
commit f85f0eee1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 371 additions and 96 deletions

View file

@ -110,6 +110,7 @@ class Status extends ImmutablePureComponent {
onToggleCollapsed: PropTypes.func,
onTranslate: PropTypes.func,
onInteractionModal: PropTypes.func,
onQuoteCancel: PropTypes.func,
muted: PropTypes.bool,
hidden: PropTypes.bool,
unread: PropTypes.bool,
@ -583,7 +584,7 @@ class Status extends ImmutablePureComponent {
<DisplayName account={status.get('account')} />
</Link>
{this.props.contextType === 'compose' && isQuotedPost && (
{isQuotedPost && !!this.props.onQuoteCancel && (
<IconButton
onClick={this.handleQuoteCancel}
className='status__quote-cancel'

View file

@ -63,12 +63,21 @@ type GetStatusSelector = (
props: { id?: string | null; contextType?: string },
) => Status | null;
export const QuotedStatus: React.FC<{
interface QuotedStatusProps {
quote: QuoteMap;
contextType?: string;
variant?: 'full' | 'link';
nestingLevel?: number;
}> = ({ quote, contextType, nestingLevel = 1, variant = 'full' }) => {
onQuoteCancel?: () => void; // Used for composer.
}
export const QuotedStatus: React.FC<QuotedStatusProps> = ({
quote,
contextType,
nestingLevel = 1,
variant = 'full',
onQuoteCancel,
}) => {
const dispatch = useAppDispatch();
const quotedStatusId = quote.get('quoted_status');
const quoteState = quote.get('state');
@ -160,6 +169,7 @@ export const QuotedStatus: React.FC<{
id={quotedStatusId}
contextType={contextType}
avatarSize={32}
onQuoteCancel={onQuoteCancel}
>
{canRenderChildQuote && (
<QuotedStatus