diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index 70737c2c0..38262bce3 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -1083,19 +1083,7 @@ void SendGiftBox( }; button->setClickedCallback([=] { const auto star = std::get_if(&descriptor); - if (v::is(descriptor)) { - if (state->sending) { - return; - } else { - state->sending = true; - } - SendGift( - window, - peer, - api, - GiftDetails{ descriptor }, - premiumSent); - } else if (star && star->limitedCount && !star->limitedLeft) { + if (star && star->limitedCount && !star->limitedLeft) { window->showToast({ .title = tr::lng_gift_sold_out_title(tr::now), .text = tr::lng_gift_sold_out_text( diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 46e9c52e3..ec57dee50 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -5421,8 +5421,18 @@ void HistoryItem::applyAction(const MTPMessageAction &action) { _media = std::make_unique( this, _from, - Data::GiftType::Premium, - data.vmonths().v); + Data::GiftCode{ + .message = (data.vmessage() + ? TextWithEntities{ + .text = qs(data.vmessage()->data().vtext()), + .entities = Api::EntitiesFromMTP( + &history()->session(), + data.vmessage()->data().ventities().v), + } + : TextWithEntities()), + .count = data.vmonths().v, + .type = Data::GiftType::Premium, + }); }, [&](const MTPDmessageActionSuggestProfilePhoto &data) { data.vphoto().match([&](const MTPDphoto &photo) { _flags |= MessageFlag::IsUserpicSuggestion; @@ -5453,6 +5463,14 @@ void HistoryItem::applyAction(const MTPMessageAction &action) { _from, Data::GiftCode{ .slug = qs(data.vslug()), + .message = (data.vmessage() + ? TextWithEntities{ + .text = qs(data.vmessage()->data().vtext()), + .entities = Api::EntitiesFromMTP( + &history()->session(), + data.vmessage()->data().ventities().v), + } + : TextWithEntities()), .channel = (boostedId ? history()->owner().channel(boostedId).get() : nullptr), diff --git a/Telegram/SourceFiles/mtproto/scheme/api.tl b/Telegram/SourceFiles/mtproto/scheme/api.tl index de269021f..72acb3884 100644 --- a/Telegram/SourceFiles/mtproto/scheme/api.tl +++ b/Telegram/SourceFiles/mtproto/scheme/api.tl @@ -169,13 +169,13 @@ messageActionSetChatTheme#aa786345 emoticon:string = MessageAction; messageActionChatJoinedByRequest#ebbca3cb = MessageAction; messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; -messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long = MessageAction; +messageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction; messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction; messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAction; messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; +messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction; messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; messageActionGiveawayResults#87e2f155 flags:# stars:flags.0?true winners_count:int unclaimed_count:int = MessageAction; messageActionBoostApply#cc02aa6d boosts:int = MessageAction; @@ -1476,7 +1476,7 @@ help.premiumPromo#5334759c status_text:string status_entities:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose; inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; inputStorePaymentStarsTopup#dddd0f56 stars:long currency:string amount:long = InputStorePaymentPurpose; inputStorePaymentStarsGift#1d741ef7 user_id:InputUser stars:long currency:string amount:long = InputStorePaymentPurpose; @@ -2565,4 +2565,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 189 +// LAYER 190 diff --git a/Telegram/SourceFiles/payments/payments_form.cpp b/Telegram/SourceFiles/payments/payments_form.cpp index 322cb6c80..56d107b7d 100644 --- a/Telegram/SourceFiles/payments/payments_form.cpp +++ b/Telegram/SourceFiles/payments/payments_form.cpp @@ -415,7 +415,8 @@ MTPInputInvoice Form::inputInvoice() const { using Flag = MTPDinputStorePaymentPremiumGiftCode::Flag; return MTP_inputInvoicePremiumGiftCode( MTP_inputStorePaymentPremiumGiftCode( - MTP_flags(users->boostPeer ? Flag::f_boost_peer : Flag()), + MTP_flags((users->boostPeer ? Flag::f_boost_peer : Flag()) + | (users->message.empty() ? Flag(0) : Flag::f_message)), MTP_vector_from_range(ranges::views::all( users->users ) | ranges::views::transform([](not_null user) { @@ -423,7 +424,13 @@ MTPInputInvoice Form::inputInvoice() const { })), users->boostPeer ? users->boostPeer->input : MTPInputPeer(), MTP_string(giftCode.currency), - MTP_long(giftCode.amount)), + MTP_long(giftCode.amount), + MTP_textWithEntities( + MTP_string(users->message.text), + Api::EntitiesToMTP( + &users->users.front()->session(), + users->message.entities, + Api::ConvertOption::SkipLocal))), option); } else { return MTP_inputInvoicePremiumGiftCode(