Message: Fix forwarding service notifications
This commit is contained in:
parent
586ed4bdb2
commit
492d0538ed
@ -15,7 +15,8 @@ import {
|
||||
selectAllowedMessageActions,
|
||||
selectCanScheduleUntilOnline,
|
||||
selectChat,
|
||||
selectCurrentMessageList, selectIsChatProtected, selectIsCurrentUserPremium,
|
||||
selectCurrentMessageList,
|
||||
selectIsCurrentUserPremium,
|
||||
selectIsMessageProtected,
|
||||
selectIsPremiumPurchaseBlocked,
|
||||
selectMessageCustomEmojiSets,
|
||||
@ -505,6 +506,7 @@ export default memo(withGlobal<OwnProps>(
|
||||
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<OwnProps>(
|
||||
&& !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<OwnProps>(
|
||||
canDelete,
|
||||
canReport,
|
||||
canEdit: !isPinned && canEdit,
|
||||
canForward: message.isForwardingAllowed && !isChatProtected && !isScheduled && canForward,
|
||||
canForward: !isScheduled && canForward,
|
||||
canFaveSticker: !isScheduled && canFaveSticker,
|
||||
canUnfaveSticker: !isScheduled && canUnfaveSticker,
|
||||
canCopy: canCopyNumber || (!isProtected && canCopy),
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user