From 2a41ab05628945dd2750f354a592a0df27725fd5 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 21 Sep 2022 19:04:36 +0300 Subject: [PATCH] Don't add self speculatively to channel members if join requests are enabled in the chat. --- td/telegram/ContactsManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index d7cd587b1..90e35a643 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -7243,7 +7243,9 @@ void ContactsManager::add_channel_participant(ChannelId channel_id, UserId user_ return promise.set_error(Status::Error(400, "Can't return to kicked from chat")); } - speculative_add_channel_user(channel_id, user_id, DialogParticipantStatus::Member(), c->status); + if (!get_channel_join_request(c)) { + speculative_add_channel_user(channel_id, user_id, DialogParticipantStatus::Member(), c->status); + } td_->create_handler(std::move(promise))->send(channel_id); return; }