From 49fc066480150e1ea7859f8aaa1600d66c7e7a4d Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 8 Dec 2020 13:39:54 +0400 Subject: [PATCH] Handle GROUPCALL_FORBIDDEN in joinGroupCall. --- Telegram/SourceFiles/calls/calls_group_call.cpp | 2 ++ Telegram/SourceFiles/data/data_peer.cpp | 9 ++++++--- Telegram/SourceFiles/history/history_widget.cpp | 6 +++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls_group_call.cpp b/Telegram/SourceFiles/calls/calls_group_call.cpp index 40e57ffaf4..9ba7dccc50 100644 --- a/Telegram/SourceFiles/calls/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/calls_group_call.cpp @@ -240,6 +240,8 @@ void GroupCall::rejoin() { ? tr::lng_group_call_no_anonymous(tr::now) : type == u"GROUPCALL_PARTICIPANTS_TOO_MUCH"_q ? tr::lng_group_call_too_many(tr::now) + : type == u"GROUPCALL_FORBIDDEN"_q + ? tr::lng_group_not_accessible(tr::now) : Lang::Hard::ServerError()), }); }).send(); diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index 2883bf42c1..ed236792ed 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/image/image.h" #include "ui/empty_userpic.h" #include "ui/text/text_options.h" +#include "ui/toasts/common_toasts.h" #include "history/history.h" #include "history/view/history_view_element.h" #include "history/history_item.h" @@ -108,9 +109,11 @@ void PeerClickHandler::onClick(ClickContext context) const { && !clickedChannel->amIn() && (!currentPeer->isChannel() || currentPeer->asChannel()->linkedChat() != clickedChannel)) { - Ui::show(Box(_peer->isMegagroup() - ? tr::lng_group_not_accessible(tr::now) - : tr::lng_channel_not_accessible(tr::now))); + Ui::ShowMultilineToast({ + .text = (_peer->isMegagroup() + ? tr::lng_group_not_accessible(tr::now) + : tr::lng_channel_not_accessible(tr::now)), + }); } else { window->showPeerHistory( _peer, diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index bb0ec76a05..feefa41fbf 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2397,7 +2397,11 @@ void HistoryWidget::messagesFailed(const RPCError &error, int requestId) { || error.type() == qstr("USER_BANNED_IN_CHANNEL")) { auto was = _peer; controller()->showBackFromStack(); - Ui::show(Box((was && was->isMegagroup()) ? tr::lng_group_not_accessible(tr::now) : tr::lng_channel_not_accessible(tr::now))); + Ui::ShowMultilineToast({ + .text = ((was && was->isMegagroup()) + ? tr::lng_group_not_accessible(tr::now) + : tr::lng_channel_not_accessible(tr::now)), + }); return; }