Resolve unknown story on open.

This commit is contained in:
John Preston 2023-06-21 13:15:59 +04:00
parent 80bec508b6
commit 4e39144d0f
3 changed files with 12 additions and 2 deletions

View File

@ -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(

View File

@ -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);
}));
}
}

View File

@ -717,6 +717,8 @@ private:
using ReactionIconFactory = HistoryView::Reactions::CachedIconFactory;
std::unique_ptr<ReactionIconFactory> _cachedReactionIconFactory;
base::has_weak_ptr _storyOpenGuard;
GiftPremiumValidator _giftPremiumValidator;
QString _premiumRef;