diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 99ec8b5b..0dd13d60 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4076,7 +4076,7 @@ deleteAccount reason:string = Ok; //@description Removes a chat action bar without any other action @chat_id Chat identifier removeChatActionBar chat_id:int53 = Ok; -//@description Reports a chat to the Telegram moderators. Supported only for supergroups, channels, or private chats with bots, since other chats can't be checked by moderators, or when the report is done from the chat action bar @chat_id Chat identifier @reason The reason for reporting the chat @message_ids Identifiers of reported messages, if any +//@description Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if this is a private chats with a bot, a private chat with a user sharing their location, a supergroup, or a channel, since other chats can't be checked by moderators @chat_id Chat identifier @reason The reason for reporting the chat @message_ids Identifiers of reported messages, if any reportChat chat_id:int53 reason:ChatReportReason message_ids:vector = Ok; diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 8e2c9cc8..71dbfd96 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4928,6 +4928,7 @@ void ContactsManager::on_update_peer_located(vectormessages_manager_->force_create_dialog(dialog_id, "on_update_peer_located"); if (from_update) { + CHECK(dialog_type == DialogType::User); bool is_found = false; for (auto &dialog_nearby : users_nearby_) { if (dialog_nearby.dialog_id == dialog_id) { @@ -4941,11 +4942,16 @@ void ContactsManager::on_update_peer_located(vectoris_deleted && u->is_bot && !u->is_support; + return u != nullptr && !u->is_deleted && !u->is_support && (u->is_bot || all_users_nearby_.count(user_id) != 0); } const ContactsManager::User *ContactsManager::get_user(UserId user_id) const { diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index d91844db..a6e08fff 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -1425,6 +1425,7 @@ class ContactsManager : public Actor { vector users_nearby_; vector channels_nearby_; + std::unordered_set all_users_nearby_; std::unordered_map linked_channel_ids_; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 9a53fab1..d43de6af 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6942,7 +6942,7 @@ void MessagesManager::report_dialog(DialogId dialog_id, const tl_object_ptr> StickersManager::prepare_input_sticker(td_api::inputSticker *sticker) { if (sticker == nullptr) { - return Status::Error(3, "Input sticker shouldn't be empty"); + return Status::Error(3, "Input sticker must not be empty"); } if (!clean_input_string(sticker->emojis_)) {