Message: Fix forwarding service notifications
This commit is contained in:
parent
586ed4bdb2
commit
492d0538ed
@ -15,7 +15,8 @@ import {
|
|||||||
selectAllowedMessageActions,
|
selectAllowedMessageActions,
|
||||||
selectCanScheduleUntilOnline,
|
selectCanScheduleUntilOnline,
|
||||||
selectChat,
|
selectChat,
|
||||||
selectCurrentMessageList, selectIsChatProtected, selectIsCurrentUserPremium,
|
selectCurrentMessageList,
|
||||||
|
selectIsCurrentUserPremium,
|
||||||
selectIsMessageProtected,
|
selectIsMessageProtected,
|
||||||
selectIsPremiumPurchaseBlocked,
|
selectIsPremiumPurchaseBlocked,
|
||||||
selectMessageCustomEmojiSets,
|
selectMessageCustomEmojiSets,
|
||||||
@ -505,6 +506,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
canRevote,
|
canRevote,
|
||||||
canClosePoll,
|
canClosePoll,
|
||||||
} = (threadId && selectAllowedMessageActions(global, message, threadId)) || {};
|
} = (threadId && selectAllowedMessageActions(global, message, threadId)) || {};
|
||||||
|
|
||||||
const isPinned = messageListType === 'pinned';
|
const isPinned = messageListType === 'pinned';
|
||||||
const isScheduled = messageListType === 'scheduled';
|
const isScheduled = messageListType === 'scheduled';
|
||||||
const isChannel = chat && isChatChannel(chat);
|
const isChannel = chat && isChatChannel(chat);
|
||||||
@ -524,7 +526,6 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
&& !areReactionsEmpty(message.reactions) && message.reactions.canSeeList;
|
&& !areReactionsEmpty(message.reactions) && message.reactions.canSeeList;
|
||||||
const canRemoveReaction = isPrivate && message.reactions?.results?.some((l) => l.isChosen);
|
const canRemoveReaction = isPrivate && message.reactions?.results?.some((l) => l.isChosen);
|
||||||
const isProtected = selectIsMessageProtected(global, message);
|
const isProtected = selectIsMessageProtected(global, message);
|
||||||
const isChatProtected = selectIsChatProtected(global, message.chatId);
|
|
||||||
const canCopyNumber = Boolean(message.content.contact);
|
const canCopyNumber = Boolean(message.content.contact);
|
||||||
const isCurrentUserPremium = selectIsCurrentUserPremium(global);
|
const isCurrentUserPremium = selectIsCurrentUserPremium(global);
|
||||||
|
|
||||||
@ -544,7 +545,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
canDelete,
|
canDelete,
|
||||||
canReport,
|
canReport,
|
||||||
canEdit: !isPinned && canEdit,
|
canEdit: !isPinned && canEdit,
|
||||||
canForward: message.isForwardingAllowed && !isChatProtected && !isScheduled && canForward,
|
canForward: !isScheduled && canForward,
|
||||||
canFaveSticker: !isScheduled && canFaveSticker,
|
canFaveSticker: !isScheduled && canFaveSticker,
|
||||||
canUnfaveSticker: !isScheduled && canUnfaveSticker,
|
canUnfaveSticker: !isScheduled && canUnfaveSticker,
|
||||||
canCopy: canCopyNumber || (!isProtected && canCopy),
|
canCopy: canCopyNumber || (!isProtected && canCopy),
|
||||||
|
|||||||
@ -446,7 +446,10 @@ export function selectAllowedMessageActions(global: GlobalState, message: ApiMes
|
|||||||
|| (isChannel && (chat.isCreator || getHasAdminRight(chat, 'editMessages')))
|
|| (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 hasSticker = Boolean(message.content.sticker);
|
||||||
const hasFavoriteSticker = hasSticker && selectIsStickerFavorite(global, 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);
|
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) {
|
export function selectSponsoredMessage(global: GlobalState, chatId: string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user