Print: Hide protected content (#5670)

This commit is contained in:
zubiden 2025-03-01 17:59:32 +01:00 committed by Alexander Zinchuk
parent e54989c791
commit c923f0264d
3 changed files with 10 additions and 0 deletions

View File

@ -38,6 +38,7 @@ import {
selectCurrentMessageIds,
selectFirstUnreadId,
selectFocusedMessageId,
selectIsChatProtected,
selectIsChatWithSelf,
selectIsCurrentUserPremium,
selectIsInSelectMode,
@ -124,6 +125,7 @@ type StateProps = {
currentUserId: string;
areAdsEnabled?: boolean;
channelJoinInfo?: ApiChatFullInfo['joinInfo'];
isChatProtected?: boolean;
};
const MESSAGE_REACTIONS_POLLING_INTERVAL = 20 * 1000;
@ -178,6 +180,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
isContactRequirePremium,
areAdsEnabled,
channelJoinInfo,
isChatProtected,
onIntersectPinnedMessage,
onScrollDownToggle,
onNotchToggle,
@ -653,6 +656,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
isScrolled && 'scrolled',
!isReady && 'is-animating',
hasOpenChatButton && 'saved-dialog',
isChatProtected && 'hide-on-print',
);
const hasMessages = (messageIds && messageGroups) || lastMessage;
@ -795,6 +799,7 @@ export default memo(withGlobal<OwnProps>(
isForum: chat.isForum,
isEmptyThread,
currentUserId,
isChatProtected: selectIsChatProtected(global, chatId),
...(withLastMessageWhenPreloading && { lastMessage }),
};
},

View File

@ -683,6 +683,7 @@ const Message: FC<OwnProps & StateProps> = ({
const containerClassName = buildClassName(
'Message message-list-item',
isFirstInGroup && 'first-in-group',
isProtected && 'hide-on-print',
isProtected && !hasTextContent ? 'is-protected' : 'allow-selection',
isLastInGroup && 'last-in-group',
isFirstInDocumentGroup && 'first-in-document-group',

View File

@ -55,4 +55,8 @@
background: var(--color-background-own) !important;
color: var(--color-text) !important;
}
.hide-on-print {
visibility: hidden !important;
}
}