diff --git a/src/api/gramjs/apiBuilders/messages.ts b/src/api/gramjs/apiBuilders/messages.ts index afc59a2e8..0103067d6 100644 --- a/src/api/gramjs/apiBuilders/messages.ts +++ b/src/api/gramjs/apiBuilders/messages.ts @@ -548,14 +548,29 @@ function buildAction( text = 'BoostingGiveawayJustStarted'; translationValues.push('%action_origin%'); } else if (action instanceof GramJs.MessageActionGiftCode) { - text = 'BoostingReceivedGiftNoName'; + text = isOutgoing ? 'ActionGiftOutbound' : 'BoostingReceivedGiftNoName'; slug = action.slug; months = action.months; + amount = action.amount?.toJSNumber(); isGiveaway = Boolean(action.viaGiveaway); isUnclaimed = Boolean(action.unclaimed); + if (isOutgoing) { + translationValues.push('%gift_payment_amount%'); + } + currency = action.currency; + if (action.cryptoCurrency) { + const cryptoAmountWithDecimals = action.cryptoAmount!.divide(1e7).toJSNumber() / 100; + giftCryptoInfo = { + currency: action.cryptoCurrency, + amount: cryptoAmountWithDecimals.toFixed(2), + }; + } if (action.boostPeer) { targetChatId = getApiChatIdFromMtpPeer(action.boostPeer); } + if (targetPeerId) { + targetUserIds.push(targetPeerId); + } } else if (action instanceof GramJs.MessageActionGiveawayResults) { if (!action.winnersCount) { text = 'lng_action_giveaway_results_none'; diff --git a/src/api/gramjs/apiBuilders/symbols.ts b/src/api/gramjs/apiBuilders/symbols.ts index d883756e5..337281262 100644 --- a/src/api/gramjs/apiBuilders/symbols.ts +++ b/src/api/gramjs/apiBuilders/symbols.ts @@ -186,9 +186,11 @@ export function buildApiEmojiInteraction(json: GramJsEmojiInteraction): ApiEmoji export function processStickerPackResult(packs: GramJs.StickerPack[]) { return packs.reduce((acc, { emoticon, documents }) => { - acc[emoticon] = documents.map((documentId) => buildStickerFromDocument( - localDb.documents[String(documentId)], - )).filter(Boolean); + acc[emoticon] = documents.map((documentId) => { + const document = localDb.documents[String(documentId)]; + if (!document) return undefined; + return buildStickerFromDocument(document); + }).filter(Boolean); return acc; }, {} as Record); } diff --git a/src/components/main/premium/PremiumMainModal.tsx b/src/components/main/premium/PremiumMainModal.tsx index f04a9efc4..9a6026732 100644 --- a/src/components/main/premium/PremiumMainModal.tsx +++ b/src/components/main/premium/PremiumMainModal.tsx @@ -382,7 +382,7 @@ const PremiumMainModal: FC = ({
{renderText(getHeaderDescription(), ['simple_markdown', 'emoji'])}
- {!isPremium && renderSubscriptionOptions()} + {!isPremium && !isGift && renderSubscriptionOptions()}

{lang('TelegramPremium')} diff --git a/src/components/middle/ActionMessage.tsx b/src/components/middle/ActionMessage.tsx index 410c3112e..4b69e72ba 100644 --- a/src/components/middle/ActionMessage.tsx +++ b/src/components/middle/ActionMessage.tsx @@ -13,7 +13,7 @@ import type { FocusDirection, ThreadId } from '../../types'; import type { PinnedIntersectionChangedCallback } from './hooks/usePinnedMessage'; import { - getChatTitle, getMessageHtmlId, isChatChannel, isJoinedChannelMessage, + getChatTitle, getMessageHtmlId, isJoinedChannelMessage, } from '../../global/helpers'; import { getMessageReplyInfo } from '../../global/helpers/replies'; import { @@ -257,9 +257,9 @@ const ActionMessage: FC = ({ /> {lang(isUnclaimed ? 'BoostingUnclaimedPrize' : 'BoostingCongratulations')} - {renderText(lang(isFromGiveaway ? 'BoostingReceivedGiftFrom' : isUnclaimed + {targetChat && renderText(lang(isFromGiveaway ? 'BoostingReceivedGiftFrom' : isUnclaimed ? 'BoostingReceivedPrizeFrom' : 'BoostingYouHaveUnclaimedPrize', - getChatTitle(lang, targetChat!)), + getChatTitle(lang, targetChat)), ['simple_markdown'])} @@ -322,7 +322,6 @@ export default memo(withGlobal( chatId, senderId, content, } = message; - const userId = senderId; const { targetUserIds, targetChatId } = content.action || {}; const targetMessageId = getMessageReplyInfo(message)?.replyToMsgId; const targetMessage = targetMessageId @@ -335,10 +334,8 @@ export default memo(withGlobal( noHighlight: noFocusHighlight, } = (isFocused && selectTabState(global).focusedMessage) || {}; - const chat = selectChat(global, chatId); - const isChat = chat && (isChatChannel(chat) || userId === chatId); - const senderUser = !isChat && userId ? selectUser(global, userId) : undefined; - const senderChat = isChat ? chat : undefined; + const senderUser = selectUser(global, senderId || chatId); + const senderChat = selectChat(global, chatId); const targetChat = targetChatId ? selectChat(global, targetChatId) : undefined; diff --git a/src/components/middle/MessageList.tsx b/src/components/middle/MessageList.tsx index 6189172b9..94c0c6b76 100644 --- a/src/components/middle/MessageList.tsx +++ b/src/components/middle/MessageList.tsx @@ -616,7 +616,7 @@ const MessageList: FC = ({ {restrictionReason ? restrictionReason.text : `This is a private ${isChannelChat ? 'channel' : 'chat'}`}

- ) : isContactRequirePremium ? ( + ) : isContactRequirePremium && !hasMessages ? ( ) : isBot && !hasMessages ? (