From ab74ed0fa75639191fc2fe5a41c1e6f0d2381db1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 29 Mar 2024 09:49:13 +0400 Subject: [PATCH] Handle flood errors in birthday changes. --- Telegram/SourceFiles/core/local_url_handlers.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 5e4afae2ac..44474df655 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -697,8 +697,11 @@ bool ShowEditBirthday( )).done(crl::guard(controller, [=] { controller->showToast(tr::lng_settings_birthday_saved(tr::now)); })).fail(crl::guard(controller, [=](const MTP::Error &error) { - controller->showToast(u"Error: "_q + error.type()); - })).send(); + const auto type = error.type(); + controller->showToast(type.startsWith(u"FLOOD_WAIT_"_q) + ? tr::lng_flood_error(tr::now) + : (u"Error: "_q + error.type())); + })).handleFloodErrors().send(); }; controller->show(Box( Ui::EditBirthdayBox,