From 5b57e011864c9bf02522398529dc3cdea0958631 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 27 Oct 2021 15:02:42 +1100 Subject: [PATCH] make sure click to trust sender renders without new lines --- ts/components/conversation/message/ClickToTrustSender.tsx | 3 ++- .../conversation/message/MessageContentWithStatus.tsx | 6 +++--- ts/state/selectors/conversations.ts | 8 +++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ts/components/conversation/message/ClickToTrustSender.tsx b/ts/components/conversation/message/ClickToTrustSender.tsx index 33b40c39f..f7ecd86f9 100644 --- a/ts/components/conversation/message/ClickToTrustSender.tsx +++ b/ts/components/conversation/message/ClickToTrustSender.tsx @@ -8,7 +8,7 @@ import { SessionIcon } from '../../session/icon'; import { SessionButtonColor } from '../../session/SessionButton'; const StyledTrustSenderUI = styled.div` - padding: 'var(--margins-md)'; + padding-inline: var(--margins-xs); display: flex; align-items: center; `; @@ -16,6 +16,7 @@ const StyledTrustSenderUI = styled.div` const ClickToDownload = styled.div` cursor: pointer; padding: var(--margins-xs) var(--margins-md); + white-space: nowrap; `; export const ClickToTrustSender = (props: { messageId: string }) => { diff --git a/ts/components/conversation/message/MessageContentWithStatus.tsx b/ts/components/conversation/message/MessageContentWithStatus.tsx index ac9896112..d2b330e44 100644 --- a/ts/components/conversation/message/MessageContentWithStatus.tsx +++ b/ts/components/conversation/message/MessageContentWithStatus.tsx @@ -15,7 +15,7 @@ import { MessageStatus } from './MessageStatus'; export type MessageContentWithStatusSelectorProps = Pick< MessageRenderingProps, - 'direction' | 'isDeleted' + 'direction' | 'isDeleted' | 'isTrustedForAttachmentDownload' > & { hasAttachments: boolean }; type Props = { @@ -48,7 +48,7 @@ export const MessageContentWithStatuses = (props: Props) => { if (!contentProps) { return null; } - const { direction, isDeleted, hasAttachments } = contentProps; + const { direction, isDeleted, hasAttachments, isTrustedForAttachmentDownload } = contentProps; const isIncoming = direction === 'incoming'; return ( @@ -56,7 +56,7 @@ export const MessageContentWithStatuses = (props: Props) => { className={classNames('module-message', `module-message--${direction}`)} role="button" onClick={onClickOnMessageOuterContainer} - style={{ width: hasAttachments ? 'min-content' : 'auto' }} + style={{ width: hasAttachments && isTrustedForAttachmentDownload ? 'min-content' : 'auto' }} >
diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index 4b5614aa7..41f1cdd0c 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -1023,12 +1023,18 @@ export const getMessageContentWithStatusesSelectorProps = createSelector( return undefined; } - const { direction, isDeleted, attachments } = props.propsForMessage; + const { + direction, + isDeleted, + attachments, + isTrustedForAttachmentDownload, + } = props.propsForMessage; const msgProps: MessageContentWithStatusSelectorProps = { direction, isDeleted, hasAttachments: Boolean(attachments?.length) || false, + isTrustedForAttachmentDownload, }; return msgProps;