diff --git a/td/telegram/LinkManager.cpp b/td/telegram/LinkManager.cpp index a72b3e149..7c0faeac5 100644 --- a/td/telegram/LinkManager.cpp +++ b/td/telegram/LinkManager.cpp @@ -306,7 +306,8 @@ class LinkManager::InternalLinkBotStart final : public InternalLink { const Td *td = G()->td().get_actor_unsafe(); auto dialog_id = td->messages_manager_->resolve_dialog_username(bot_username_); if (dialog_id.is_valid() && dialog_id.get_type() == DialogType::User && - td->messages_manager_->get_dialog_has_last_message(dialog_id)) { + td->messages_manager_->get_dialog_has_last_message(dialog_id) && + !td->messages_manager_->is_dialog_blocked(dialog_id)) { autostart = true; } } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 79bc0f6fe..86bd59127 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -17720,6 +17720,11 @@ void MessagesManager::block_message_sender_from_replies_on_server(MessageId mess ->send(message_id, need_delete_message, need_delete_all_messages, report_spam); } +bool MessagesManager::is_dialog_blocked(DialogId dialog_id) const { + const Dialog *d = get_dialog(dialog_id); + return d != nullptr && d->is_blocked; +} + void MessagesManager::get_blocked_dialogs(int32 offset, int32 limit, Promise> &&promise) { if (offset < 0) { diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 6a1e1cee3..543cef303 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -615,6 +615,8 @@ class MessagesManager final : public Actor { void block_message_sender_from_replies(MessageId message_id, bool need_delete_message, bool need_delete_all_messages, bool report_spam, Promise &&promise); + bool is_dialog_blocked(DialogId dialog_id) const; + void get_blocked_dialogs(int32 offset, int32 limit, Promise> &&promise); void on_get_blocked_dialogs(int32 offset, int32 limit, int32 total_count,