2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 23:25:15 +00:00

Allow opening unknown stories from chats list.

This commit is contained in:
John Preston
2023-07-14 12:02:04 +04:00
parent 3c28e7b585
commit 10f65c63e7
3 changed files with 35 additions and 8 deletions

View File

@@ -2528,9 +2528,10 @@ void SessionController::openPeerStory(
if (from) {
window().openInMediaView(OpenRequest(this, *from, context));
} else if (from.error() == Data::NoStory::Unknown) {
stories.resolve({ peer->id, storyId }, crl::guard(&_storyOpenGuard, [=] {
const auto done = crl::guard(&_storyOpenGuard, [=] {
openPeerStory(peer, storyId, context);
}));
});
stories.resolve({ peer->id, storyId }, done);
}
}
@@ -2540,6 +2541,7 @@ void SessionController::openPeerStories(
using namespace Media::View;
using namespace Data;
invalidate_weak_ptrs(&_storyOpenGuard);
auto &stories = session().data().stories();
if (const auto source = stories.source(peerId)) {
if (const auto idDates = source->toOpen()) {
@@ -2550,6 +2552,13 @@ void SessionController::openPeerStories(
? StoriesContext{ *list }
: StoriesContext{ StoriesContextPeer() }));
}
} else if (const auto userId = peerToUser(peerId)) {
if (const auto user = session().data().userLoaded(userId)) {
const auto done = crl::guard(&_storyOpenGuard, [=] {
openPeerStories(peerId, list);
});
stories.requestUserStories(user, done);
}
}
}