Saved Gifts: Update saved gifts after upgrade gift (#6259)
This commit is contained in:
parent
1d4db8f131
commit
0d6388b3d9
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -170,6 +170,10 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inputInvoice?.type === 'stargiftUpgrade' && global.currentUserId) {
|
||||||
|
actions.reloadPeerSavedGifts({ peerId: global.currentUserId });
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user