From 09206c7369b27d92f27feffebf6ace75bf33e504 Mon Sep 17 00:00:00 2001 From: Echo Date: Thu, 5 Feb 2026 13:58:00 +0100 Subject: [PATCH] [Glitch] Cancel quote button appearing in all statuses Port d2dca826dd06c78e562a9eaf96c9993d6bbe2e08 to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/components/status.jsx | 3 +- .../glitch/components/status/header.tsx | 7 +++- .../glitch/components/status/types.ts | 36 +++++++++++++++++++ .../glitch/components/status_quoted.tsx | 16 +++++---- 4 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 app/javascript/flavours/glitch/components/status/types.ts diff --git a/app/javascript/flavours/glitch/components/status.jsx b/app/javascript/flavours/glitch/components/status.jsx index b369579219..5ebfda987c 100644 --- a/app/javascript/flavours/glitch/components/status.jsx +++ b/app/javascript/flavours/glitch/components/status.jsx @@ -157,6 +157,7 @@ class Status extends ImmutablePureComponent { 'expanded', 'unread', 'pictureInPicture', + 'headerRenderFn', 'previousId', 'nextInReplyToId', 'rootId', @@ -685,7 +686,7 @@ class Status extends ImmutablePureComponent { const {statusContentProps, hashtagBar} = getHashtagBarForStatus(status); const header = this.props.headerRenderFn - ? this.props.headerRenderFn({ status, account, avatarSize, messages, onHeaderClick: this.handleHeaderClick }) + ? this.props.headerRenderFn({ status, account, avatarSize, messages, onHeaderClick: this.handleHeaderClick, statusProps: this.props }) : ( ; } -export type StatusHeaderRenderFn = (args: StatusHeaderProps) => ReactNode; +export type StatusHeaderRenderFn = ( + args: StatusHeaderProps, + statusProps?: StatusProps, +) => ReactNode; export const StatusHeader: FC = ({ status, diff --git a/app/javascript/flavours/glitch/components/status/types.ts b/app/javascript/flavours/glitch/components/status/types.ts new file mode 100644 index 0000000000..9c4796f790 --- /dev/null +++ b/app/javascript/flavours/glitch/components/status/types.ts @@ -0,0 +1,36 @@ +import type { ComponentClass, MouseEventHandler, ReactNode } from 'react'; + +import type { Account } from '@/flavours/glitch/models/account'; + +import type { StatusHeaderRenderFn } from './header'; + +// Taken from the Status component. +export interface StatusProps { + account?: Account; + children?: ReactNode; + previousId?: string; + rootId?: string; + onClick?: MouseEventHandler; + muted?: boolean; + hidden?: boolean; + unread?: boolean; + showThread?: boolean; + showActions?: boolean; + isQuotedPost?: boolean; + shouldHighlightOnMount?: boolean; + getScrollPosition?: () => null | { height: number; top: number }; + updateScrollBottom?: (snapshot: number) => void; + cacheMediaWidth?: (width: number) => void; + cachedMediaWidth?: number; + scrollKey?: string; + skipPrepend?: boolean; + avatarSize?: number; + unfocusable?: boolean; + headerRenderFn?: StatusHeaderRenderFn; + contextType?: string; +} + +export type StatusComponent = ComponentClass< + StatusProps, + { showMedia?: boolean; showDespiteFilter?: boolean } +>; diff --git a/app/javascript/flavours/glitch/components/status_quoted.tsx b/app/javascript/flavours/glitch/components/status_quoted.tsx index 858096f964..42287b315e 100644 --- a/app/javascript/flavours/glitch/components/status_quoted.tsx +++ b/app/javascript/flavours/glitch/components/status_quoted.tsx @@ -227,13 +227,15 @@ export const QuotedStatus: React.FC = ({ const headerRenderFn: StatusHeaderRenderFn = useCallback( (props) => ( - + {onQuoteCancel && ( + + )} ), [intl, onQuoteCancel],