diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index d24137894a..45bc8298c9 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -871,10 +871,18 @@ void StickersListWidget::paintSticker(Painter &p, Set &set, int y, int index, bo auto w = qMax(qRound(coef * sticker->dimensions.width()), 1); auto h = qMax(qRound(coef * sticker->dimensions.height()), 1); auto ppos = pos + QPoint((_singleSize.width() - w) / 2, (_singleSize.height() - h) / 2); + auto paintImage = [&](ImagePtr image) { + if (image->loaded()) { + p.drawPixmapLeft( + ppos, + width(), + image->pixSingle(w, h, w, h, ImageRoundRadius::None)); + } + }; if (goodThumb) { - p.drawPixmapLeft(ppos, width(), sticker->thumb->pixSingle(w, h, w, h, ImageRoundRadius::None)); + paintImage(sticker->thumb); } else if (!sticker->sticker()->img->isNull()) { - p.drawPixmapLeft(ppos, width(), sticker->sticker()->img->pixSingle(w, h, w, h, ImageRoundRadius::None)); + paintImage(sticker->sticker()->img); } if (selected && stickerHasDeleteButton(set, index)) { diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index 303313308b..251ce57b59 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -590,9 +590,28 @@ bool WrapWidget::showInternal( return false; } auto content = infoMemento->content(); - if (_controller->validateMementoPeer(content)) { - if (_content->showInternal(content)) { + auto skipInternal = !_historyStack.empty() + && (params.way == Window::SectionShow::Way::ClearStack); + if (_controller->validateMementoPeer(content) + && infoMemento->stackSize() == 1) { + if (!skipInternal && _content->showInternal(content)) { return true; + } else if (_topTabs) { + // If we open the profile being in the media tab. + // Just switch back to the profile tab. + auto type = content->section().type(); + if (type == Section::Type::Profile + && _tab != Tab::Profile) { + _anotherTabMemento = std::move(infoMemento->takeStack().back()); + _topTabs->setActiveSection(static_cast(Tab::Profile)); + return true; + } else if (type == Section::Type::Media + && _tab != Tab::Media + && Media::TypeToTabIndex(content->section().mediaType()).has_value()) { + _anotherTabMemento = std::move(infoMemento->takeStack().back()); + _topTabs->setActiveSection(static_cast(Tab::Media)); + return true; + } } } showNewContent(