Various fixes (#4486)
This commit is contained in:
parent
7221a19cf1
commit
2dc4e9d6cf
@ -548,14 +548,29 @@ function buildAction(
|
|||||||
text = 'BoostingGiveawayJustStarted';
|
text = 'BoostingGiveawayJustStarted';
|
||||||
translationValues.push('%action_origin%');
|
translationValues.push('%action_origin%');
|
||||||
} else if (action instanceof GramJs.MessageActionGiftCode) {
|
} else if (action instanceof GramJs.MessageActionGiftCode) {
|
||||||
text = 'BoostingReceivedGiftNoName';
|
text = isOutgoing ? 'ActionGiftOutbound' : 'BoostingReceivedGiftNoName';
|
||||||
slug = action.slug;
|
slug = action.slug;
|
||||||
months = action.months;
|
months = action.months;
|
||||||
|
amount = action.amount?.toJSNumber();
|
||||||
isGiveaway = Boolean(action.viaGiveaway);
|
isGiveaway = Boolean(action.viaGiveaway);
|
||||||
isUnclaimed = Boolean(action.unclaimed);
|
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) {
|
if (action.boostPeer) {
|
||||||
targetChatId = getApiChatIdFromMtpPeer(action.boostPeer);
|
targetChatId = getApiChatIdFromMtpPeer(action.boostPeer);
|
||||||
}
|
}
|
||||||
|
if (targetPeerId) {
|
||||||
|
targetUserIds.push(targetPeerId);
|
||||||
|
}
|
||||||
} else if (action instanceof GramJs.MessageActionGiveawayResults) {
|
} else if (action instanceof GramJs.MessageActionGiveawayResults) {
|
||||||
if (!action.winnersCount) {
|
if (!action.winnersCount) {
|
||||||
text = 'lng_action_giveaway_results_none';
|
text = 'lng_action_giveaway_results_none';
|
||||||
|
|||||||
@ -186,9 +186,11 @@ export function buildApiEmojiInteraction(json: GramJsEmojiInteraction): ApiEmoji
|
|||||||
|
|
||||||
export function processStickerPackResult(packs: GramJs.StickerPack[]) {
|
export function processStickerPackResult(packs: GramJs.StickerPack[]) {
|
||||||
return packs.reduce((acc, { emoticon, documents }) => {
|
return packs.reduce((acc, { emoticon, documents }) => {
|
||||||
acc[emoticon] = documents.map((documentId) => buildStickerFromDocument(
|
acc[emoticon] = documents.map((documentId) => {
|
||||||
localDb.documents[String(documentId)],
|
const document = localDb.documents[String(documentId)];
|
||||||
)).filter(Boolean);
|
if (!document) return undefined;
|
||||||
|
return buildStickerFromDocument(document);
|
||||||
|
}).filter(Boolean);
|
||||||
return acc;
|
return acc;
|
||||||
}, {} as Record<string, ApiSticker[]>);
|
}, {} as Record<string, ApiSticker[]>);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -382,7 +382,7 @@ const PremiumMainModal: FC<OwnProps & StateProps> = ({
|
|||||||
<div className={styles.description}>
|
<div className={styles.description}>
|
||||||
{renderText(getHeaderDescription(), ['simple_markdown', 'emoji'])}
|
{renderText(getHeaderDescription(), ['simple_markdown', 'emoji'])}
|
||||||
</div>
|
</div>
|
||||||
{!isPremium && renderSubscriptionOptions()}
|
{!isPremium && !isGift && renderSubscriptionOptions()}
|
||||||
<div className={buildClassName(styles.header, isHeaderHidden && styles.hiddenHeader)}>
|
<div className={buildClassName(styles.header, isHeaderHidden && styles.hiddenHeader)}>
|
||||||
<h2 className={styles.premiumHeaderText}>
|
<h2 className={styles.premiumHeaderText}>
|
||||||
{lang('TelegramPremium')}
|
{lang('TelegramPremium')}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import type { FocusDirection, ThreadId } from '../../types';
|
|||||||
import type { PinnedIntersectionChangedCallback } from './hooks/usePinnedMessage';
|
import type { PinnedIntersectionChangedCallback } from './hooks/usePinnedMessage';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getChatTitle, getMessageHtmlId, isChatChannel, isJoinedChannelMessage,
|
getChatTitle, getMessageHtmlId, isJoinedChannelMessage,
|
||||||
} from '../../global/helpers';
|
} from '../../global/helpers';
|
||||||
import { getMessageReplyInfo } from '../../global/helpers/replies';
|
import { getMessageReplyInfo } from '../../global/helpers/replies';
|
||||||
import {
|
import {
|
||||||
@ -257,9 +257,9 @@ const ActionMessage: FC<OwnProps & StateProps> = ({
|
|||||||
/>
|
/>
|
||||||
<strong>{lang(isUnclaimed ? 'BoostingUnclaimedPrize' : 'BoostingCongratulations')}</strong>
|
<strong>{lang(isUnclaimed ? 'BoostingUnclaimedPrize' : 'BoostingCongratulations')}</strong>
|
||||||
<span className="action-message-subtitle">
|
<span className="action-message-subtitle">
|
||||||
{renderText(lang(isFromGiveaway ? 'BoostingReceivedGiftFrom' : isUnclaimed
|
{targetChat && renderText(lang(isFromGiveaway ? 'BoostingReceivedGiftFrom' : isUnclaimed
|
||||||
? 'BoostingReceivedPrizeFrom' : 'BoostingYouHaveUnclaimedPrize',
|
? 'BoostingReceivedPrizeFrom' : 'BoostingYouHaveUnclaimedPrize',
|
||||||
getChatTitle(lang, targetChat!)),
|
getChatTitle(lang, targetChat)),
|
||||||
['simple_markdown'])}
|
['simple_markdown'])}
|
||||||
</span>
|
</span>
|
||||||
<span className="action-message-subtitle">
|
<span className="action-message-subtitle">
|
||||||
@ -322,7 +322,6 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
chatId, senderId, content,
|
chatId, senderId, content,
|
||||||
} = message;
|
} = message;
|
||||||
|
|
||||||
const userId = senderId;
|
|
||||||
const { targetUserIds, targetChatId } = content.action || {};
|
const { targetUserIds, targetChatId } = content.action || {};
|
||||||
const targetMessageId = getMessageReplyInfo(message)?.replyToMsgId;
|
const targetMessageId = getMessageReplyInfo(message)?.replyToMsgId;
|
||||||
const targetMessage = targetMessageId
|
const targetMessage = targetMessageId
|
||||||
@ -335,10 +334,8 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
noHighlight: noFocusHighlight,
|
noHighlight: noFocusHighlight,
|
||||||
} = (isFocused && selectTabState(global).focusedMessage) || {};
|
} = (isFocused && selectTabState(global).focusedMessage) || {};
|
||||||
|
|
||||||
const chat = selectChat(global, chatId);
|
const senderUser = selectUser(global, senderId || chatId);
|
||||||
const isChat = chat && (isChatChannel(chat) || userId === chatId);
|
const senderChat = selectChat(global, chatId);
|
||||||
const senderUser = !isChat && userId ? selectUser(global, userId) : undefined;
|
|
||||||
const senderChat = isChat ? chat : undefined;
|
|
||||||
|
|
||||||
const targetChat = targetChatId ? selectChat(global, targetChatId) : undefined;
|
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'}`}
|
{restrictionReason ? restrictionReason.text : `This is a private ${isChannelChat ? 'channel' : 'chat'}`}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
) : isContactRequirePremium ? (
|
) : isContactRequirePremium && !hasMessages ? (
|
||||||
<PremiumRequiredMessage userId={chatId} />
|
<PremiumRequiredMessage userId={chatId} />
|
||||||
) : isBot && !hasMessages ? (
|
) : isBot && !hasMessages ? (
|
||||||
<MessageListBotInfo chatId={chatId} />
|
<MessageListBotInfo chatId={chatId} />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user