Saved Gifts: Update saved gifts after upgrade gift (#6259)

This commit is contained in:
Alexander Zinchuk 2025-09-19 14:35:34 +02:00
parent 1d4db8f131
commit 0d6388b3d9
2 changed files with 11 additions and 2 deletions

View File

@ -1002,7 +1002,7 @@ addActionHandler('launchPrepaidStarsGiveaway', async (global, actions, payload):
actions.openBoostStatistics({ chatId, tabId }); actions.openBoostStatistics({ chatId, tabId });
}); });
addActionHandler('upgradeGift', (global, actions, payload): ActionReturnType => { addActionHandler('upgradeGift', async (global, actions, payload): Promise<void> => {
const { const {
gift, shouldKeepOriginalDetails, upgradeStars, tabId = getCurrentTabId(), gift, shouldKeepOriginalDetails, upgradeStars, tabId = getCurrentTabId(),
} = payload; } = payload;
@ -1023,11 +1023,16 @@ addActionHandler('upgradeGift', (global, actions, payload): ActionReturnType =>
actions.closeGiftInfoModal({ tabId }); actions.closeGiftInfoModal({ tabId });
if (!upgradeStars) { if (!upgradeStars) {
callApi('upgradeStarGift', { const result = await callApi('upgradeStarGift', {
inputSavedGift: requestSavedGift, inputSavedGift: requestSavedGift,
shouldKeepOriginalDetails: shouldKeepOriginalDetails || undefined, shouldKeepOriginalDetails: shouldKeepOriginalDetails || undefined,
}); });
global = getGlobal();
if (result && global.currentUserId) {
actions.reloadPeerSavedGifts({ peerId: global.currentUserId });
}
return; return;
} }

View File

@ -170,6 +170,10 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
} }
} }
if (inputInvoice?.type === 'stargiftUpgrade' && global.currentUserId) {
actions.reloadPeerSavedGifts({ peerId: global.currentUserId });
}
break; break;
} }