From 9aa80976ff357e6ca5fe605d85654f5f1dda3a9e Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 10 Feb 2025 10:43:49 +0400 Subject: [PATCH] Fix viewing gifts from the list. --- .../peer_gifts/info_peer_gifts_widget.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp index a30b7b584..9656bd08a 100644 --- a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp +++ b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp @@ -343,11 +343,11 @@ void InnerWidget::validateButtons() { } const auto giftId = _entries[index].gift.info.id; const auto manageId = _entries[index].gift.manageId; + const auto &descriptor = _entries[index].descriptor; const auto already = ranges::find(_views, giftId, &View::giftId); if (already != end(_views)) { views.push_back(base::take(*already)); } else { - const auto &descriptor = _entries[index].descriptor; const auto unused = ranges::find_if(_views, [&](const View &v) { return v.button && !idUsed(v.giftId, column, row); }); @@ -358,16 +358,16 @@ void InnerWidget::validateButtons() { button->show(); views.push_back({ .button = std::move(button) }); } - auto &view = views.back(); - const auto callback = [=] { - showGift(index); - }; - view.index = index; - view.manageId = manageId; - view.giftId = giftId; - view.button->setDescriptor(descriptor, mode); - view.button->setClickedCallback(callback); } + auto &view = views.back(); + const auto callback = [=] { + showGift(index); + }; + view.index = index; + view.manageId = manageId; + view.giftId = giftId; + view.button->setDescriptor(descriptor, mode); + view.button->setClickedCallback(callback); return true; }; for (auto j = fromRow; j != tillRow; ++j) {