mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +02:00
parent
4d40336be0
commit
4db2505f5d
1 changed files with 13 additions and 12 deletions
|
@ -1489,32 +1489,33 @@ void OverlayWidget::onForward() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::onDelete() {
|
void OverlayWidget::onDelete() {
|
||||||
const auto session = _session;
|
if (!_session) {
|
||||||
if (!session) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
close();
|
const auto session = _session;
|
||||||
const auto deletingPeerPhoto = [this] {
|
const auto photo = _photo;
|
||||||
|
const auto msgid = _msgid;
|
||||||
|
const auto deletingPeerPhoto = [&] {
|
||||||
if (!_msgid) {
|
if (!_msgid) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (_photo && _history) {
|
||||||
if (_photo && _history) {
|
|
||||||
if (_history->peer->userpicPhotoId() == _photo->id) {
|
if (_history->peer->userpicPhotoId() == _photo->id) {
|
||||||
return _firstOpenedPeerPhoto;
|
return _firstOpenedPeerPhoto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
}();
|
||||||
|
close();
|
||||||
|
|
||||||
Core::App().domain().activate(&_session->account());
|
Core::App().domain().activate(&session->account());
|
||||||
const auto &active = _session->windows();
|
const auto &active = session->windows();
|
||||||
if (active.empty()) {
|
if (active.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (deletingPeerPhoto()) {
|
if (deletingPeerPhoto) {
|
||||||
active.front()->content()->deletePhotoLayer(_photo);
|
active.front()->content()->deletePhotoLayer(photo);
|
||||||
} else if (const auto item = session->data().message(_msgid)) {
|
} else if (const auto item = session->data().message(msgid)) {
|
||||||
const auto suggestModerateActions = true;
|
const auto suggestModerateActions = true;
|
||||||
Ui::show(Box<DeleteMessagesBox>(item, suggestModerateActions));
|
Ui::show(Box<DeleteMessagesBox>(item, suggestModerateActions));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue