From 220ad5352b478ffb55fbbf471996d8b45d7b0b32 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 9 Sep 2020 03:40:17 +0300 Subject: [PATCH] Allow write access to linked supergroups. GitOrigin-RevId: 05008f9e07dc1d0759235431d999d59f50d7e820 --- td/telegram/ContactsManager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 1e3f0b054..94fe60545 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4161,6 +4161,14 @@ bool ContactsManager::have_input_peer_channel(const Channel *c, ChannelId channe if (dialog_access_by_invite_link_.count(DialogId(channel_id))) { return true; } + } else { + if (!from_linked && c->is_megagroup) { + auto linked_channel_id = get_linked_channel_id(channel_id); + if (linked_channel_id.is_valid()) { + return !c->username.empty() || c->has_location || + have_input_peer_channel(get_channel(linked_channel_id), linked_channel_id, AccessRights::Read, true); + } + } } if (!c->status.is_member()) { return false;