diff --git a/Telegram/SourceFiles/api/api_premium.cpp b/Telegram/SourceFiles/api/api_premium.cpp index c23cca814..37307fe60 100644 --- a/Telegram/SourceFiles/api/api_premium.cpp +++ b/Telegram/SourceFiles/api/api_premium.cpp @@ -26,7 +26,7 @@ namespace { [[nodiscard]] GiftCode Parse(const MTPDpayments_checkedGiftCode &data) { return { - .from = peerFromMTP(data.vfrom_id()), + .from = data.vfrom_id() ? peerFromMTP(*data.vfrom_id()) : PeerId(), .to = data.vto_id() ? peerFromUser(*data.vto_id()) : PeerId(), .giveawayId = data.vgiveaway_msg_id().value_or_empty(), .date = data.vdate().v, diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index 08110dea5..37ce14e12 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -370,18 +370,20 @@ void AddTable( container, st::giveawayGiftCodeTable), st::giveawayGiftCodeTableMargin); - AddTableRow( - table, - tr::lng_gift_link_label_from(), - controller, - current.from); + if (current.from) { + AddTableRow( + table, + tr::lng_gift_link_label_from(), + controller, + current.from); + } if (current.to) { AddTableRow( table, tr::lng_gift_link_label_to(), controller, current.to); - } else { + } else if (current.from) { AddTableRow( table, tr::lng_gift_link_label_to(), @@ -723,11 +725,17 @@ void GiftCodePendingBox( void ResolveGiftCode( not_null controller, - const QString &slug) { + const QString &slug, + PeerId fromId, + PeerId toId) { const auto done = [=](Api::GiftCode code) { if (!code) { controller->showToast(tr::lng_gift_link_expired(tr::now)); } else { + if (!code.from) { + code.from = fromId; + code.to = toId; + } controller->uiShow()->showBox(Box(GiftCodeBox, controller, slug)); } }; diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.h b/Telegram/SourceFiles/boxes/gift_premium_box.h index 1ea8d21d9..c9fdc1b5f 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.h +++ b/Telegram/SourceFiles/boxes/gift_premium_box.h @@ -57,7 +57,9 @@ void GiftCodePendingBox( const Api::GiftCode &data); void ResolveGiftCode( not_null controller, - const QString &slug); + const QString &slug, + PeerId fromId = 0, + PeerId toId = 0); void ResolveGiveawayInfo( not_null controller, diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 2d5f88283..85c4b7917 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -344,9 +344,19 @@ bool ResolveUsernameOrPhone( qthelp::UrlParamNameTransform::ToLower); const auto domainParam = params.value(u"domain"_q); const auto appnameParam = params.value(u"appname"_q); + const auto myContext = context.value(); if (domainParam == u"giftcode"_q && !appnameParam.isEmpty()) { - ResolveGiftCode(controller, appnameParam); + const auto itemId = myContext.itemId; + const auto item = controller->session().data().message(itemId); + const auto fromId = item ? item->from()->id : PeerId(); + const auto selfId = controller->session().userPeerId(); + const auto toId = !item + ? PeerId() + : (fromId == selfId) + ? item->history()->peer->id + : selfId; + ResolveGiftCode(controller, appnameParam, fromId, toId); return true; } @@ -413,7 +423,6 @@ bool ResolveUsernameOrPhone( startToken = params.value(u"startapp"_q); } } - const auto myContext = context.value(); controller->window().activate(); controller->showPeerByLink(Window::PeerByLinkInfo{ .usernameOrId = domain, diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index fcbe1cd6c..78187be76 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -770,6 +770,7 @@ void GenerateItems( using LogChangePeerColor = MTPDchannelAdminLogEventActionChangePeerColor; using LogChangeProfilePeerColor = MTPDchannelAdminLogEventActionChangeProfilePeerColor; using LogChangeWallpaper = MTPDchannelAdminLogEventActionChangeWallpaper; + using LogChangeEmojiStatus = MTPDchannelAdminLogEventActionChangeEmojiStatus; const auto session = &history->session(); const auto id = event.vid().v; @@ -1908,6 +1909,10 @@ void GenerateItems( Ui::Text::WithEntities)); }; + const auto createChangeEmojiStatus = [&](const LogChangeEmojiStatus &data) { + + }; + action.match( createChangeTitle, createChangeAbout, @@ -1954,7 +1959,8 @@ void GenerateItems( createToggleAntiSpam, createChangePeerColor, createChangeProfilePeerColor, - createChangeWallpaper); + createChangeWallpaper, + createChangeEmojiStatus); } } // namespace AdminLog diff --git a/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp b/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp index a1b60cb67..ad3e9dc47 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp @@ -90,14 +90,16 @@ ClickHandlerPtr PremiumGift::createViewLink() { return std::make_shared([=](ClickContext context) { const auto my = context.other.value(); if (const auto controller = my.sessionWindow.get()) { + const auto selfId = controller->session().userPeerId(); + const auto self = (from->id == selfId); if (data.slug.isEmpty()) { - const auto selfId = controller->session().userPeerId(); - const auto self = (from->id == selfId); const auto peer = self ? to : from; const auto months = data.months; Settings::ShowGiftPremium(controller, peer, months, self); } else { - ResolveGiftCode(controller, data.slug); + const auto fromId = from->id; + const auto toId = self ? to->id : selfId; + ResolveGiftCode(controller, data.slug, fromId, toId); } } }); diff --git a/Telegram/SourceFiles/mtproto/scheme/api.tl b/Telegram/SourceFiles/mtproto/scheme/api.tl index ea586c3b6..7a71a7088 100644 --- a/Telegram/SourceFiles/mtproto/scheme/api.tl +++ b/Telegram/SourceFiles/mtproto/scheme/api.tl @@ -97,7 +97,7 @@ userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#29562865 id:long = Chat; chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat; chatForbidden#6592a1a7 id:long title:string = Chat; -channel#a636a3e2 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor = Chat; +channel#aadfc8f flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int = Chat; channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions = ChatFull; @@ -397,6 +397,7 @@ updateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update; updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; updateBotMessageReaction#ac21d3ce peer:Peer msg_id:int date:int actor:Peer old_reactions:Vector new_reactions:Vector qts:int = Update; +updateBotMessageReactions#9cb7759 peer:Peer msg_id:int date:int reactions:Vector qts:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -594,7 +595,7 @@ inputStickerSetEmojiGenericAnimations#4c4d4ce = InputStickerSet; inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet; inputStickerSetEmojiDefaultTopicIcons#44c1f8e9 = InputStickerSet; -stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true videos:flags.6?true emojis:flags.7?true text_color:flags.9?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; +stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true videos:flags.6?true emojis:flags.7?true text_color:flags.9?true channel_emoji_status:flags.10?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; messages.stickerSet#6e153f16 set:StickerSet packs:Vector keywords:Vector documents:Vector = messages.StickerSet; messages.stickerSetNotModified#d3f924eb = messages.StickerSet; @@ -974,6 +975,7 @@ channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminL channelAdminLogEventActionChangePeerColor#5796e780 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; channelAdminLogEventActionChangeProfilePeerColor#5e477b25 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_value:WallPaper = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; @@ -1587,7 +1589,7 @@ messages.webPage#fd5e12bd webpage:WebPage chats:Vector users:Vector premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption; -payments.checkedGiftCode#b722f158 flags:# via_giveaway:flags.2?true from_id:Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; +payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo; payments.giveawayInfoResults#cd5570 flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.0?string finish_date:int winners_count:int activated_count:int = payments.GiveawayInfo; @@ -1755,6 +1757,7 @@ account.deleteAutoSaveExceptions#53bc0020 = Bool; account.invalidateSignInCodes#ca8ae8ba codes:Vector = Bool; account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int background_emoji_id:flags.0?long = Bool; account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; +account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -2078,6 +2081,7 @@ channels.clickSponsoredMessage#18afbc93 channel:InputChannel random_id:bytes = B channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; channels.getChannelRecommendations#83b70d97 channel:InputChannel = messages.Chats; +channels.updateEmojiStatus#f0d3e6a8 channel:InputChannel emoji_status:EmojiStatus = Updates; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;