File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,15 @@ export function StarGiftBubble(props: {
7676 return < I18nTsx key = "StarGiftDefaultMessageUpgrade" />
7777 }
7878
79+ if ( props . gift . isConverted && props . gift . isIncoming ) {
80+ return (
81+ < I18nTsx
82+ key = "StarGiftGotStars"
83+ args = { `${ props . gift . raw . convert_stars } ` }
84+ />
85+ ) ;
86+ }
87+
7988 if ( props . gift . raw . convert_stars !== undefined && ! props . gift . isUpgraded ) {
8089 return props . gift . isIncoming ? (
8190 < I18nTsx
Original file line number Diff line number Diff line change @@ -876,6 +876,7 @@ export default function showStarGiftInfoPopup(options: {
876876 try {
877877 await managers . appGiftsManager . convertGift ( input ) ;
878878 context . hide ( ) ;
879+ toastNew ( { langPackKey : 'StarGiftGotStars' , langPackArguments : [ + saved . convert_stars ] } ) ;
879880 } catch ( err ) {
880881 toastNew ( { langPackKey : 'Error.AnError' } ) ;
881882 }
Original file line number Diff line number Diff line change @@ -4019,6 +4019,10 @@ const lang = {
40194019 'one_value' : 'Add this gift to your profile or convert it to %d Star.' ,
40204020 'other_value' : 'Add this gift to your profile or convert it to %d Stars.'
40214021 } ,
4022+ 'StarGiftGotStars' : {
4023+ 'one_value' : 'You got **%d Star** for this gift.' ,
4024+ 'other_value' : 'You got **%d Stars** for this gift.'
4025+ } ,
40224026 'StarGiftDefaultMessageConvertableOut' : {
40234027 'one_value' : '%2$s can add this gift on their profile or convert it to %1$d Star.' ,
40244028 'other_value' : '%2$s can add this gift on their profile or convert it to %1$d Stars.'
Original file line number Diff line number Diff line change @@ -419,6 +419,24 @@ export default class AppGiftsManager extends AppManager {
419419 await this . apiManager . invokeApiSingle ( 'payments.convertStarGift' , {
420420 stargift : gift
421421 } ) ;
422+
423+ // * the server does not edit the gift's message, so it is marked here for its bubble to say so
424+ if ( gift . _ !== 'inputSavedStarGiftUser' ) return ;
425+ const mid = this . appMessagesIdsManager . generateMessageId ( gift . msg_id ) ;
426+ const message = this . appMessagesManager . getMessageById ( mid ) as Message . messageService ;
427+ if ( message ?. _ !== 'messageService' || message . action . _ !== 'messageActionStarGift' ) return ;
428+
429+ const storage = this . appMessagesManager . getHistoryMessagesStorage ( message . peerId ) ;
430+ this . appMessagesManager . modifyMessage ( message , ( message ) => {
431+ ( message . action as MessageAction . messageActionStarGift ) . pFlags . converted = true ;
432+ } , storage ) ;
433+
434+ this . rootScope . dispatchEvent ( 'message_edit' , {
435+ storageKey : storage . key ,
436+ peerId : message . peerId ,
437+ mid : message . mid ,
438+ message
439+ } ) ;
422440 }
423441
424442 public async getPremiumGiftOptions ( ) : Promise < MyPremiumGiftOption [ ] > {
Original file line number Diff line number Diff line change 35243524"StarGiftDefaultMessageOut" = "%s can display this gift on their profile.";
35253525"StarGiftDefaultMessageConvertable_one" = "Add this gift to your profile or convert it to %d Star.";
35263526"StarGiftDefaultMessageConvertable_other" = "Add this gift to your profile or convert it to %d Stars.";
3527+ "StarGiftGotStars_one" = "You got **%d Star** for this gift.";
3528+ "StarGiftGotStars_other" = "You got **%d Stars** for this gift.";
35273529"StarGiftDefaultMessageConvertableOut_one" = "%2$s can add this gift on their profile or convert it to %1$d Star.";
35283530"StarGiftDefaultMessageConvertableOut_other" = "%2$s can add this gift on their profile or convert it to %1$d Stars.";
35293531"StarGiftDefaultMessageUpgrade" = "Upgrade this gift to a unique collectible.";
You can’t perform that action at this time.
0 commit comments