mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-17 15:23:36 +01:00
Add debug message option to MessageContextMenu
This commit is contained in:
@@ -73,6 +73,7 @@ export const CallingNotification: React.FC<PropsType> = React.memo(
|
||||
});
|
||||
}}
|
||||
shouldShowAdditional={false}
|
||||
onDebugMessage={null}
|
||||
onDownload={null}
|
||||
onEdit={null}
|
||||
onReplyToMessage={null}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import React, { useRef, type ReactNode } from 'react';
|
||||
import type { LocalizerType } from '../../types/I18N.std.js';
|
||||
import { AxoMenuBuilder } from '../../axo/AxoMenuBuilder.dom.js';
|
||||
import { isInternalFeaturesEnabled } from '../../util/isInternalFeaturesEnabled.dom.js';
|
||||
|
||||
type MessageContextMenuProps = Readonly<{
|
||||
i18n: LocalizerType;
|
||||
@@ -11,6 +12,7 @@ type MessageContextMenuProps = Readonly<{
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
disabled?: boolean;
|
||||
shouldShowAdditional: boolean;
|
||||
onDebugMessage: (() => void) | null;
|
||||
onDownload: (() => void) | null;
|
||||
onEdit: (() => void) | null;
|
||||
onReplyToMessage: (() => void) | null;
|
||||
@@ -34,6 +36,7 @@ export function MessageContextMenu({
|
||||
onOpenChange,
|
||||
disabled,
|
||||
shouldShowAdditional,
|
||||
onDebugMessage,
|
||||
onDownload,
|
||||
onEdit,
|
||||
onReplyToMessage,
|
||||
@@ -162,6 +165,17 @@ export function MessageContextMenu({
|
||||
{i18n('icu:retryDeleteForEveryone')}
|
||||
</AxoMenuBuilder.Item>
|
||||
)}
|
||||
{isInternalFeaturesEnabled() && onDebugMessage && (
|
||||
<>
|
||||
<AxoMenuBuilder.Separator />
|
||||
<AxoMenuBuilder.Group>
|
||||
<AxoMenuBuilder.Label>Internal</AxoMenuBuilder.Label>
|
||||
<AxoMenuBuilder.Item symbol="copy" onSelect={onDebugMessage}>
|
||||
Copy & debug message
|
||||
</AxoMenuBuilder.Item>
|
||||
</AxoMenuBuilder.Group>
|
||||
</>
|
||||
)}
|
||||
</AxoMenuBuilder.Content>
|
||||
</AxoMenuBuilder.Root>
|
||||
);
|
||||
|
||||
@@ -112,6 +112,7 @@ const defaultMessageProps: TimelineMessagesProps = {
|
||||
isSMS: false,
|
||||
isSpoilerExpanded: {},
|
||||
isVoiceMessagePlayed: false,
|
||||
handleDebugMessage: action('debugMessage'),
|
||||
toggleSelectMessage: action('toggleSelectMessage'),
|
||||
cancelAttachmentDownload: action('default--cancelAttachmentDownload'),
|
||||
kickOffAttachmentDownload: action('default--kickOffAttachmentDownload'),
|
||||
|
||||
@@ -374,6 +374,7 @@ const renderItem = ({
|
||||
containerWidthBreakpoint={containerWidthBreakpoint}
|
||||
conversationId=""
|
||||
item={items[messageId]}
|
||||
handleDebugMessage={action('handleDebugMessage')}
|
||||
renderAudioAttachment={() => <div>*AudioAttachment*</div>}
|
||||
renderContact={() => <div>*ContactName*</div>}
|
||||
renderReactionPicker={() => <div />}
|
||||
|
||||
@@ -50,6 +50,7 @@ const getDefaultProps = () => ({
|
||||
interactionMode: 'keyboard' as const,
|
||||
theme: ThemeType.light,
|
||||
platform: 'darwin',
|
||||
handleDebugMessage: action('handleDebugMessage'),
|
||||
targetMessage: action('targetMessage'),
|
||||
toggleSelectMessage: action('toggleSelectMessage'),
|
||||
endPoll: action('endPoll'),
|
||||
|
||||
@@ -268,6 +268,7 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
||||
expirationTimestamp: overrideProps.expirationTimestamp ?? 0,
|
||||
getPreferredBadge: overrideProps.getPreferredBadge || (() => undefined),
|
||||
giftBadge: overrideProps.giftBadge,
|
||||
handleDebugMessage: action('handleDebugMessage'),
|
||||
i18n,
|
||||
platform: 'darwin',
|
||||
id: overrideProps.id ?? 'random-message-id',
|
||||
|
||||
@@ -86,6 +86,7 @@ export type PropsActions = {
|
||||
messageId: string,
|
||||
isPinningDisappearingMessage: boolean
|
||||
) => void;
|
||||
handleDebugMessage: () => void;
|
||||
} & Omit<MessagePropsActions, 'onToggleSelect' | 'onReplyToMessage'>;
|
||||
|
||||
export type Props = PropsData &
|
||||
@@ -125,6 +126,7 @@ export function TimelineMessage(props: Props): React.JSX.Element {
|
||||
copyMessageText,
|
||||
endPoll,
|
||||
expirationLength,
|
||||
handleDebugMessage,
|
||||
onPinnedMessageRemove,
|
||||
pushPanelForConversation,
|
||||
reactToMessage,
|
||||
@@ -367,6 +369,7 @@ export function TimelineMessage(props: Props): React.JSX.Element {
|
||||
args: { messageId: id },
|
||||
})
|
||||
}
|
||||
onDebugMessage={handleDebugMessage}
|
||||
>
|
||||
{children}
|
||||
</MessageContextMenu>
|
||||
@@ -383,6 +386,7 @@ export function TimelineMessage(props: Props): React.JSX.Element {
|
||||
canRetryDeleteForEveryone,
|
||||
conversationId,
|
||||
copyMessageText,
|
||||
handleDebugMessage,
|
||||
handleDownload,
|
||||
handleReact,
|
||||
handleOpenPinMessageDialog,
|
||||
|
||||
Reference in New Issue
Block a user