Skip to content

Commit

Permalink
Allow messagePremiumGiftCode.creator_id == null.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Dec 22, 2023
1 parent d60bb8d commit 5b8fff9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion td/generate/scheme/td_api.tl
Original file line number Diff line number Diff line change
Expand Up @@ -2882,7 +2882,7 @@ messagePaymentSuccessfulBot currency:string total_amount:int53 is_recurring:Bool
messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent;

//@description A Telegram Premium gift code was created for the user
//@creator_id Identifier of a chat or a user that created the gift code
//@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown
//@is_from_giveaway True, if the gift code was created for a giveaway
//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen
//@month_count Number of month the Telegram Premium subscription will be active after code activation
Expand Down
13 changes: 8 additions & 5 deletions td/telegram/MessageContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6392,9 +6392,9 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
LOG(ERROR) << "Receive invalid " << oneline(to_string(action));
break;
}
}
if (dialog_id.get_type() != DialogType::User) {
td->messages_manager_->force_create_dialog(dialog_id, "messageActionGiftCode", true);
if (dialog_id.get_type() != DialogType::User) {
td->messages_manager_->force_create_dialog(dialog_id, "messageActionGiftCode", true);
}
}
return td::make_unique<MessageGiftCode>(dialog_id, action->months_, action->via_giveaway_, action->unclaimed_,
std::move(action->slug_));
Expand Down Expand Up @@ -6781,8 +6781,11 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
case MessageContentType::GiftCode: {
const auto *m = static_cast<const MessageGiftCode *>(content);
return td_api::make_object<td_api::messagePremiumGiftCode>(
get_message_sender_object(td, m->creator_dialog_id, "messagePremiumGiftCode"), m->via_giveaway,
m->is_unclaimed, m->months, td->stickers_manager_->get_premium_gift_sticker_object(m->months), m->code);
m->creator_dialog_id.is_valid()
? get_message_sender_object(td, m->creator_dialog_id, "messagePremiumGiftCode")
: nullptr,
m->via_giveaway, m->is_unclaimed, m->months,
td->stickers_manager_->get_premium_gift_sticker_object(m->months), m->code);
}
case MessageContentType::Giveaway: {
const auto *m = static_cast<const MessageGiveaway *>(content);
Expand Down

0 comments on commit 5b8fff9

Please sign in to comment.