Various fixes for quotes and giveaways (#3964)
This commit is contained in:
parent
3904c313c8
commit
51f606760c
@ -338,6 +338,7 @@ function buildAction(
|
||||
let isTopicAction: boolean | undefined;
|
||||
let slug: string | undefined;
|
||||
let isGiveaway: boolean | undefined;
|
||||
let isUnclaimed: boolean | undefined;
|
||||
|
||||
const targetUserIds = 'users' in action
|
||||
? action.users && action.users.map((id) => buildApiPeerId(id, 'user'))
|
||||
@ -533,6 +534,7 @@ function buildAction(
|
||||
slug = action.slug;
|
||||
months = action.months;
|
||||
isGiveaway = Boolean(action.viaGiveaway);
|
||||
isUnclaimed = Boolean(action.unclaimed);
|
||||
if (action.boostPeer) {
|
||||
targetChatId = getApiChatIdFromMtpPeer(action.boostPeer);
|
||||
}
|
||||
@ -563,6 +565,7 @@ function buildAction(
|
||||
months,
|
||||
topicEmojiIconId,
|
||||
isTopicAction,
|
||||
isUnclaimed,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -292,6 +292,7 @@ export interface ApiAction {
|
||||
isTopicAction?: boolean;
|
||||
slug?: string;
|
||||
isGiveaway?: boolean;
|
||||
isUnclaimed?: boolean;
|
||||
}
|
||||
|
||||
export interface ApiWebPage {
|
||||
|
||||
@ -148,15 +148,6 @@ const EmbeddedMessage: FC<OwnProps> = ({
|
||||
}
|
||||
|
||||
function renderSender() {
|
||||
if (forwardSenderTitle && !areSendersSame) {
|
||||
return (
|
||||
<>
|
||||
<Icon name={forwardSender ? 'share-filled' : 'forward'} className="embedded-origin-icon" />
|
||||
{renderText(forwardSenderTitle)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
if (title) {
|
||||
return renderText(title);
|
||||
}
|
||||
@ -165,11 +156,9 @@ const EmbeddedMessage: FC<OwnProps> = ({
|
||||
return NBSP;
|
||||
}
|
||||
|
||||
let shouldIgnoreSender = false;
|
||||
let icon: IconName | undefined;
|
||||
if (senderChat) {
|
||||
if (isChatChannel(senderChat)) {
|
||||
shouldIgnoreSender = true;
|
||||
icon = 'channel-filled';
|
||||
}
|
||||
|
||||
@ -178,11 +167,13 @@ const EmbeddedMessage: FC<OwnProps> = ({
|
||||
}
|
||||
}
|
||||
|
||||
const isChatSender = senderChat?.id === sender?.id;
|
||||
|
||||
return (
|
||||
<>
|
||||
{!shouldIgnoreSender && <span className="embedded-sender">{renderText(senderTitle)}</span>}
|
||||
{!isChatSender && <span className="embedded-sender">{renderText(senderTitle)}</span>}
|
||||
{icon && <Icon name={icon} className="embedded-chat-icon" />}
|
||||
{senderChatTitle && renderText(senderChatTitle)}
|
||||
{icon && senderChatTitle && renderText(senderChatTitle)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -211,6 +202,12 @@ const EmbeddedMessage: FC<OwnProps> = ({
|
||||
</p>
|
||||
<div className="message-title">
|
||||
{renderSender()}
|
||||
{forwardSenderTitle && !areSendersSame && (
|
||||
<>
|
||||
<Icon name={forwardSender ? 'share-filled' : 'forward'} className="embedded-origin-icon" />
|
||||
{renderText(forwardSenderTitle)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -392,9 +392,11 @@ function processEntity({
|
||||
return <strong data-entity-type={entity.type}>{renderNestedMessagePart()}</strong>;
|
||||
case ApiMessageEntityTypes.Blockquote:
|
||||
return (
|
||||
<blockquote data-entity-type={entity.type}>
|
||||
{renderNestedMessagePart()}
|
||||
</blockquote>
|
||||
<div className="text-entity-blockquote-wrapper">
|
||||
<blockquote data-entity-type={entity.type}>
|
||||
{renderNestedMessagePart()}
|
||||
</blockquote>
|
||||
</div>
|
||||
);
|
||||
case ApiMessageEntityTypes.BotCommand:
|
||||
return (
|
||||
|
||||
@ -236,6 +236,7 @@ const ActionMessage: FC<OwnProps & StateProps> = ({
|
||||
|
||||
function renderGiftCode() {
|
||||
const isFromGiveaway = message.content.action?.isGiveaway;
|
||||
const isUnclaimed = message.content.action?.isUnclaimed;
|
||||
return (
|
||||
<span
|
||||
className="action-message-gift action-message-gift-code"
|
||||
@ -250,10 +251,11 @@ const ActionMessage: FC<OwnProps & StateProps> = ({
|
||||
noLoop
|
||||
nonInteractive
|
||||
/>
|
||||
<strong>{lang('BoostingUnclaimedPrize')}</strong>
|
||||
<strong>{lang(isUnclaimed ? 'BoostingUnclaimedPrize' : 'BoostingCongratulations')}</strong>
|
||||
<span className="action-message-subtitle">
|
||||
{renderText(lang(isFromGiveaway ? 'BoostingReceivedGiftFrom' : 'BoostingYouHaveUnclaimedPrize',
|
||||
getChatTitle(lang, targetChat!)),
|
||||
{renderText(lang(isFromGiveaway ? 'BoostingReceivedGiftFrom' : isUnclaimed
|
||||
? 'BoostingReceivedPrizeFrom' : 'BoostingYouHaveUnclaimedPrize',
|
||||
getChatTitle(lang, targetChat!)),
|
||||
['simple_markdown'])}
|
||||
</span>
|
||||
<span className="action-message-subtitle">
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
|
||||
.gift {
|
||||
position: relative;
|
||||
margin-top: -3rem;
|
||||
}
|
||||
|
||||
.count {
|
||||
|
||||
@ -585,6 +585,7 @@ const Message: FC<OwnProps & StateProps> = ({
|
||||
Boolean(requestedChatTranslationLanguage),
|
||||
replyStory && 'content' in replyStory ? replyStory : undefined,
|
||||
isReplyPrivate,
|
||||
isRepliesChat,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -30,6 +30,7 @@ export default function useInnerHandlers(
|
||||
isTranslatingChat?: boolean,
|
||||
story?: ApiStory,
|
||||
isReplyPrivate?: boolean,
|
||||
isRepliesChat?: boolean,
|
||||
) {
|
||||
const {
|
||||
openChat, showNotification, focusMessage, openMediaViewer, openAudioPlayer,
|
||||
@ -85,10 +86,10 @@ export default function useInnerHandlers(
|
||||
|
||||
focusMessage({
|
||||
chatId: replyToPeerId || chatId,
|
||||
threadId: replyToTopId || threadId,
|
||||
threadId: isRepliesChat ? replyToTopId : threadId, // Open comments from Replies bot, otherwise, keep current thread
|
||||
messageId: replyToMsgId,
|
||||
replyMessageId: replyToPeerId ? undefined : messageId,
|
||||
noForumTopicPanel: !replyToPeerId ? true : undefined, // Open topic panel for cross-chat replies
|
||||
noForumTopicPanel: !replyToPeerId, // Open topic panel for cross-chat replies
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -421,6 +421,9 @@ export function selectSender<T extends GlobalState>(global: T, message: ApiMessa
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const chat = selectChat(global, message.chatId);
|
||||
if (chat && isChatChannel(chat)) return chat;
|
||||
|
||||
return selectPeer(global, senderId);
|
||||
}
|
||||
|
||||
|
||||
@ -1489,6 +1489,7 @@ stories.sendReaction#7fd736b2 flags:# add_to_recent:flags.0?true peer:InputPeer
|
||||
stories.getPeerStories#2c4ada50 peer:InputPeer = stories.PeerStories;
|
||||
stories.getPeerMaxIDs#535983c3 id:Vector<InputPeer> = Vector<int>;
|
||||
stories.togglePeerStoriesHidden#bd0415c4 peer:InputPeer hidden:Bool = Bool;
|
||||
premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList;
|
||||
premium.getMyBoosts#be77b4a = premium.MyBoosts;
|
||||
premium.applyBoost#6b7da746 flags:# slots:flags.0?Vector<int> peer:InputPeer = premium.MyBoosts;
|
||||
premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus;`;
|
||||
@ -319,6 +319,7 @@
|
||||
"premium.getBoostersList",
|
||||
"premium.applyBoost",
|
||||
"premium.getMyBoosts",
|
||||
"premium.getBoostsList",
|
||||
"payments.checkGiftCode",
|
||||
"payments.applyGiftCode",
|
||||
"payments.getGiveawayInfo"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user