Handle flood errors in birthday changes.

This commit is contained in:
John Preston 2024-03-29 09:49:13 +04:00
parent 0d740c21a2
commit ab74ed0fa7
1 changed files with 5 additions and 2 deletions

View File

@ -697,8 +697,11 @@ bool ShowEditBirthday(
)).done(crl::guard(controller, [=] { )).done(crl::guard(controller, [=] {
controller->showToast(tr::lng_settings_birthday_saved(tr::now)); controller->showToast(tr::lng_settings_birthday_saved(tr::now));
})).fail(crl::guard(controller, [=](const MTP::Error &error) { })).fail(crl::guard(controller, [=](const MTP::Error &error) {
controller->showToast(u"Error: "_q + error.type()); const auto type = error.type();
})).send(); controller->showToast(type.startsWith(u"FLOOD_WAIT_"_q)
? tr::lng_flood_error(tr::now)
: (u"Error: "_q + error.type()));
})).handleFloodErrors().send();
}; };
controller->show(Box( controller->show(Box(
Ui::EditBirthdayBox, Ui::EditBirthdayBox,