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

View File

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

View File

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