2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

Move peer photo update from Messenger to ApiWrap.

This commit is contained in:
John Preston
2018-09-06 14:13:54 +03:00
parent e2207e33ef
commit 8c1cc51c2e
13 changed files with 190 additions and 230 deletions

View File

@@ -960,22 +960,8 @@ void MainWidget::cancelUploadLayer(not_null<HistoryItem*> item) {
void MainWidget::deletePhotoLayer(PhotoData *photo) {
if (!photo) return;
Ui::show(Box<ConfirmBox>(lang(lng_delete_photo_sure), lang(lng_box_delete), crl::guard(this, [=] {
Auth().api().clearPeerPhoto(photo);
Ui::hideLayer();
auto me = App::self();
if (!me) return;
if (me->userpicPhotoId() == photo->id) {
Messenger::Instance().peerClearPhoto(me->id);
} else if (photo->peer && !photo->peer->isUser() && photo->peer->userpicPhotoId() == photo->id) {
Messenger::Instance().peerClearPhoto(photo->peer->id);
} else {
MTP::send(MTPphotos_DeletePhotos(
MTP_vector<MTPInputPhoto>(1, photo->mtpInput())));
Auth().storage().remove(Storage::UserPhotosRemoveOne(
me->bareId(),
photo->id));
}
})));
}