diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index a63e159c73..c65f9a2a01 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -342,7 +342,9 @@ InnerWidget::InnerWidget( _stories->clicks( ) | rpl::start_with_next([=](uint64 id) { - _controller->openPeerStories(PeerId(int64(id)), {}); + _controller->openPeerStories( + PeerId(int64(id)), + Data::StorySourcesList::NotHidden); }, lifetime()); _stories->showProfileRequests( diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 394ca23585..9758d85452 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -2522,9 +2522,15 @@ void SessionController::openPeerStory( using namespace Media::View; using namespace Data; + invalidate_weak_ptrs(&_storyOpenGuard); auto &stories = session().data().stories(); - if (const auto from = stories.lookup({ peer->id, storyId })) { + const auto from = stories.lookup({ peer->id, storyId }); + if (from) { window().openInMediaView(OpenRequest(this, *from, context)); + } else if (from.error() == Data::NoStory::Unknown) { + stories.resolve({ peer->id, storyId }, crl::guard(&_storyOpenGuard, [=] { + openPeerStory(peer, storyId, context); + })); } } diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index 7d95674275..509fa2818f 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -717,6 +717,8 @@ private: using ReactionIconFactory = HistoryView::Reactions::CachedIconFactory; std::unique_ptr _cachedReactionIconFactory; + base::has_weak_ptr _storyOpenGuard; + GiftPremiumValidator _giftPremiumValidator; QString _premiumRef;