2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Support story link previews.

This commit is contained in:
John Preston
2023-06-23 16:04:53 +04:00
parent 22b6f27f7b
commit 1b581a1597
11 changed files with 85 additions and 8 deletions

View File

@@ -455,6 +455,17 @@ void Stories::apply(not_null<PeerData*> peer, const MTPUserStories *data) {
}
}
Story *Stories::applyFromWebpage(PeerId peerId, const MTPstoryItem &story) {
const auto idDates = parseAndApply(
_owner->peer(peerId),
story,
base::unixtime::now());
const auto value = idDates
? lookup({ peerId, idDates.id })
: base::make_unexpected(NoStory::Deleted);
return value ? value->get() : nullptr;
}
void Stories::requestUserStories(not_null<UserData*> user) {
if (!_requestingUserStories.emplace(user).second) {
return;