Identify auctions by id instead of slug.

This commit is contained in:
John Preston
2025-12-26 18:11:24 +04:00
parent 0a98ee7a99
commit 43e6431b4e
7 changed files with 159 additions and 60 deletions
@@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_subsection_tabs.h"
#include "media/player/media_player_instance.h"
#include "media/view/media_view_open_common.h"
#include "data/components/gift_auctions.h"
#include "data/components/recent_peers.h"
#include "data/stickers/data_custom_emoji.h"
#include "data/data_document_resolver.h"
@@ -3652,10 +3653,29 @@ void SessionController::dropSubsectionTabs() {
void SessionController::showStarGiftAuction(const QString &slug) {
_starGiftAuctionLifetime.destroy();
const auto requesting = _starGiftAuctionLifetime.make_state<
base::has_weak_ptr
>();
const auto guard = base::make_weak(requesting);
const auto weak = base::make_weak(this);
session().giftAuctions().resolveSlug(slug, [=](uint64 giftId) {
if (!guard || !weak) {
return;
}
_starGiftAuctionLifetime.destroy();
if (giftId) {
showStarGiftAuction(giftId);
}
});
}
void SessionController::showStarGiftAuction(uint64 giftId) {
_starGiftAuctionLifetime.destroy();
_starGiftAuctionLifetime = Ui::ShowStarGiftAuction(
this,
nullptr,
slug,
giftId,
[] {},
[=] { _starGiftAuctionLifetime.destroy(); });
}