2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Save item views in App::*Item() variables.

Also remove App::contextItem.
Also use owning pointers for history context menus.
This commit is contained in:
John Preston
2018-01-11 16:07:29 +03:00
parent 8060cb7426
commit 062b0b2165
33 changed files with 1201 additions and 1056 deletions

View File

@@ -1003,8 +1003,10 @@ void MediaView::onForward() {
void MediaView::onDelete() {
close();
auto deletingPeerPhoto = [this]() {
if (!_msgid) return true;
const auto deletingPeerPhoto = [this] {
if (!_msgid) {
return true;
}
if (_photo && _history) {
if (_history->peer->userpicPhotoId() == _photo->id) {
return _firstOpenedPeerPhoto;
@@ -1015,9 +1017,8 @@ void MediaView::onDelete() {
if (deletingPeerPhoto()) {
App::main()->deletePhotoLayer(_photo);
} else if (auto item = App::histItemById(_msgid)) {
App::contextItem(item);
App::main()->deleteLayer();
} else {
App::main()->deleteLayer(_msgid);
}
}