diff --git a/src/components/middle/message/ContextMenuContainer.tsx b/src/components/middle/message/ContextMenuContainer.tsx index caf6c1b3d..cb7c3dd93 100644 --- a/src/components/middle/message/ContextMenuContainer.tsx +++ b/src/components/middle/message/ContextMenuContainer.tsx @@ -15,7 +15,8 @@ import { selectAllowedMessageActions, selectCanScheduleUntilOnline, selectChat, - selectCurrentMessageList, selectIsChatProtected, selectIsCurrentUserPremium, + selectCurrentMessageList, + selectIsCurrentUserPremium, selectIsMessageProtected, selectIsPremiumPurchaseBlocked, selectMessageCustomEmojiSets, @@ -505,6 +506,7 @@ export default memo(withGlobal( canRevote, canClosePoll, } = (threadId && selectAllowedMessageActions(global, message, threadId)) || {}; + const isPinned = messageListType === 'pinned'; const isScheduled = messageListType === 'scheduled'; const isChannel = chat && isChatChannel(chat); @@ -524,7 +526,6 @@ export default memo(withGlobal( && !areReactionsEmpty(message.reactions) && message.reactions.canSeeList; const canRemoveReaction = isPrivate && message.reactions?.results?.some((l) => l.isChosen); const isProtected = selectIsMessageProtected(global, message); - const isChatProtected = selectIsChatProtected(global, message.chatId); const canCopyNumber = Boolean(message.content.contact); const isCurrentUserPremium = selectIsCurrentUserPremium(global); @@ -544,7 +545,7 @@ export default memo(withGlobal( canDelete, canReport, canEdit: !isPinned && canEdit, - canForward: message.isForwardingAllowed && !isChatProtected && !isScheduled && canForward, + canForward: !isScheduled && canForward, canFaveSticker: !isScheduled && canFaveSticker, canUnfaveSticker: !isScheduled && canUnfaveSticker, canCopy: canCopyNumber || (!isProtected && canCopy), diff --git a/src/global/selectors/messages.ts b/src/global/selectors/messages.ts index c75172d53..cd0eb7627 100644 --- a/src/global/selectors/messages.ts +++ b/src/global/selectors/messages.ts @@ -446,7 +446,10 @@ export function selectAllowedMessageActions(global: GlobalState, message: ApiMes || (isChannel && (chat.isCreator || getHasAdminRight(chat, 'editMessages'))) ); - const canForward = !isLocal && !isAction; + const isChatProtected = selectIsChatProtected(global, message.chatId); + const canForward = ( + !isLocal && !isAction && !isChatProtected && (message.isForwardingAllowed || isServiceNotification) + ); const hasSticker = Boolean(message.content.sticker); const hasFavoriteSticker = hasSticker && selectIsStickerFavorite(global, message.content.sticker!); @@ -933,7 +936,9 @@ export function selectCanForwardMessages(global: GlobalState, chatId: string, me const messages = selectChatMessages(global, chatId); - return messageIds.every((messageId) => messages[messageId]?.isForwardingAllowed); + return messageIds + .map((id) => messages[id]) + .every((message) => message.isForwardingAllowed || isServiceNotificationMessage(message)); } export function selectSponsoredMessage(global: GlobalState, chatId: string) {