Various fixes (#4486)
This commit is contained in:
parent
7221a19cf1
commit
2dc4e9d6cf
@ -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';
|
||||
|
||||
@ -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<string, ApiSticker[]>);
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ const PremiumMainModal: FC<OwnProps & StateProps> = ({
|
||||
<div className={styles.description}>
|
||||
{renderText(getHeaderDescription(), ['simple_markdown', 'emoji'])}
|
||||
</div>
|
||||
{!isPremium && renderSubscriptionOptions()}
|
||||
{!isPremium && !isGift && renderSubscriptionOptions()}
|
||||
<div className={buildClassName(styles.header, isHeaderHidden && styles.hiddenHeader)}>
|
||||
<h2 className={styles.premiumHeaderText}>
|
||||
{lang('TelegramPremium')}
|
||||
|
||||
@ -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<OwnProps & StateProps> = ({
|
||||
/>
|
||||
<strong>{lang(isUnclaimed ? 'BoostingUnclaimedPrize' : 'BoostingCongratulations')}</strong>
|
||||
<span className="action-message-subtitle">
|
||||
{renderText(lang(isFromGiveaway ? 'BoostingReceivedGiftFrom' : isUnclaimed
|
||||
{targetChat && renderText(lang(isFromGiveaway ? 'BoostingReceivedGiftFrom' : isUnclaimed
|
||||
? 'BoostingReceivedPrizeFrom' : 'BoostingYouHaveUnclaimedPrize',
|
||||
getChatTitle(lang, targetChat!)),
|
||||
getChatTitle(lang, targetChat)),
|
||||
['simple_markdown'])}
|
||||
</span>
|
||||
<span className="action-message-subtitle">
|
||||
@ -322,7 +322,6 @@ export default memo(withGlobal<OwnProps>(
|
||||
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<OwnProps>(
|
||||
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;
|
||||
|
||||
|
||||
@ -616,7 +616,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
|
||||
{restrictionReason ? restrictionReason.text : `This is a private ${isChannelChat ? 'channel' : 'chat'}`}
|
||||
</span>
|
||||
</div>
|
||||
) : isContactRequirePremium ? (
|
||||
) : isContactRequirePremium && !hasMessages ? (
|
||||
<PremiumRequiredMessage userId={chatId} />
|
||||
) : isBot && !hasMessages ? (
|
||||
<MessageListBotInfo chatId={chatId} />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user