Fix getWebPageInstantView for loaded web pages with non-loaded instant view.
This commit is contained in:
parent
786f2dc504
commit
b2077f72e4
@ -848,13 +848,25 @@ void WebPagesManager::get_web_page_instant_view(const string &url, bool force_fu
|
|||||||
// ignore negative caching
|
// ignore negative caching
|
||||||
return reload_web_page_by_url(url, std::move(promise));
|
return reload_web_page_by_url(url, std::move(promise));
|
||||||
}
|
}
|
||||||
return get_web_page_instant_view(it->second, force_full, std::move(promise));
|
return get_web_page_instant_view_impl(it->second, force_full, std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
load_web_page_by_url(url, std::move(promise));
|
auto new_promise = PromiseCreator::lambda(
|
||||||
|
[actor_id = actor_id(this), force_full, promise = std::move(promise)](Result<WebPageId> r_web_page_id) mutable {
|
||||||
|
if (r_web_page_id.is_error()) {
|
||||||
|
promise.set_error(r_web_page_id.move_as_error());
|
||||||
|
} else {
|
||||||
|
send_closure(actor_id, &WebPagesManager::get_web_page_instant_view_impl, r_web_page_id.ok(), force_full,
|
||||||
|
std::move(promise));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
load_web_page_by_url(url, std::move(new_promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPagesManager::get_web_page_instant_view(WebPageId web_page_id, bool force_full, Promise<WebPageId> &&promise) {
|
void WebPagesManager::get_web_page_instant_view_impl(WebPageId web_page_id, bool force_full,
|
||||||
|
Promise<WebPageId> &&promise) {
|
||||||
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
|
|
||||||
LOG(INFO) << "Trying to get web page instant view for " << web_page_id;
|
LOG(INFO) << "Trying to get web page instant view for " << web_page_id;
|
||||||
|
|
||||||
const WebPageInstantView *web_page_instant_view = get_web_page_instant_view(web_page_id);
|
const WebPageInstantView *web_page_instant_view = get_web_page_instant_view(web_page_id);
|
||||||
|
@ -122,7 +122,7 @@ class WebPagesManager final : public Actor {
|
|||||||
|
|
||||||
const WebPageInstantView *get_web_page_instant_view(WebPageId web_page_id) const;
|
const WebPageInstantView *get_web_page_instant_view(WebPageId web_page_id) const;
|
||||||
|
|
||||||
void get_web_page_instant_view(WebPageId web_page_id, bool force_full, Promise<WebPageId> &&promise);
|
void get_web_page_instant_view_impl(WebPageId web_page_id, bool force_full, Promise<WebPageId> &&promise);
|
||||||
|
|
||||||
tl_object_ptr<td_api::webPageInstantView> get_web_page_instant_view_object(
|
tl_object_ptr<td_api::webPageInstantView> get_web_page_instant_view_object(
|
||||||
WebPageId web_page_id, const WebPageInstantView *web_page_instant_view) const;
|
WebPageId web_page_id, const WebPageInstantView *web_page_instant_view) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user