2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Fixed updating of parent id for file click handlers.

Fixed #16447.
This commit is contained in:
23rd
2021-06-18 07:22:47 +03:00
parent 3fd772ce17
commit 6c56fad180
10 changed files with 66 additions and 57 deletions

View File

@@ -188,9 +188,10 @@ void RadialProgressItem::setDocumentLinks(
setLinks(
std::make_shared<DocumentOpenClickHandler>(
document,
crl::guard(this, [=] {
delegate()->openDocument(document, context);
})),
crl::guard(this, [=](FullMsgId id) {
delegate()->openDocument(document, id);
}),
context),
std::make_shared<DocumentSaveClickHandler>(document, context),
std::make_shared<DocumentCancelClickHandler>(document, context));
}
@@ -277,9 +278,10 @@ Photo::Photo(
not_null<PhotoData*> photo)
: ItemBase(delegate, parent)
, _data(photo)
, _link(std::make_shared<PhotoOpenClickHandler>(photo, crl::guard(this, [=] {
delegate->openPhoto(photo, parent->fullId());
}))) {
, _link(std::make_shared<PhotoOpenClickHandler>(
photo,
crl::guard(this, [=](FullMsgId id) { delegate->openPhoto(photo, id); }),
parent->fullId())) {
if (_data->inlineThumbnailBytes().isEmpty()
&& (_data->hasExact(Data::PhotoSize::Small)
|| _data->hasExact(Data::PhotoSize::Thumbnail))) {
@@ -602,9 +604,10 @@ Voice::Voice(
, _data(voice)
, _namel(std::make_shared<DocumentOpenClickHandler>(
_data,
crl::guard(this, [=] {
delegate->openDocument(_data, parent->fullId());
})))
crl::guard(this, [=](FullMsgId id) {
delegate->openDocument(_data, id);
}),
parent->fullId()))
, _st(st) {
AddComponents(Info::Bit());
@@ -913,9 +916,10 @@ Document::Document(
, _msgl(goToMessageClickHandler(parent))
, _namel(std::make_shared<DocumentOpenClickHandler>(
_data,
crl::guard(this, [=] {
delegate->openDocument(_data, parent->fullId());
})))
crl::guard(this, [=](FullMsgId id) {
delegate->openDocument(_data, id);
}),
parent->fullId()))
, _st(st)
, _date(langDateTime(base::unixtime::parse(_data->date)))
, _datew(st::normalFont->width(_date))
@@ -1469,9 +1473,10 @@ Link::Link(
if (_page->document) {
_photol = std::make_shared<DocumentOpenClickHandler>(
_page->document,
crl::guard(this, [=] {
delegate->openDocument(_page->document, parent->fullId());
}));
crl::guard(this, [=](FullMsgId id) {
delegate->openDocument(_page->document, id);
}),
parent->fullId());
} else if (_page->photo) {
if (_page->type == WebPageType::Profile || _page->type == WebPageType::Video) {
_photol = createHandler(_page->url);
@@ -1480,9 +1485,10 @@ Link::Link(
|| _page->siteName == qstr("Facebook")) {
_photol = std::make_shared<PhotoOpenClickHandler>(
_page->photo,
crl::guard(this, [=] {
delegate->openPhoto(_page->photo, parent->fullId());
}));
crl::guard(this, [=](FullMsgId id) {
delegate->openPhoto(_page->photo, id);
}),
parent->fullId());
} else {
_photol = createHandler(_page->url);
}