Allow report private chats with users sharing their location.
GitOrigin-RevId: f1b546ea71a534436e487d4a644b4001bd274e09
This commit is contained in:
parent
190419bf8b
commit
9964c011ec
@ -4076,7 +4076,7 @@ deleteAccount reason:string = Ok;
|
|||||||
//@description Removes a chat action bar without any other action @chat_id Chat identifier
|
//@description Removes a chat action bar without any other action @chat_id Chat identifier
|
||||||
removeChatActionBar chat_id:int53 = Ok;
|
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<int53> = Ok;
|
reportChat chat_id:int53 reason:ChatReportReason message_ids:vector<int53> = Ok;
|
||||||
|
|
||||||
|
|
||||||
|
@ -4928,6 +4928,7 @@ void ContactsManager::on_update_peer_located(vector<tl_object_ptr<telegram_api::
|
|||||||
td_->messages_manager_->force_create_dialog(dialog_id, "on_update_peer_located");
|
td_->messages_manager_->force_create_dialog(dialog_id, "on_update_peer_located");
|
||||||
|
|
||||||
if (from_update) {
|
if (from_update) {
|
||||||
|
CHECK(dialog_type == DialogType::User);
|
||||||
bool is_found = false;
|
bool is_found = false;
|
||||||
for (auto &dialog_nearby : users_nearby_) {
|
for (auto &dialog_nearby : users_nearby_) {
|
||||||
if (dialog_nearby.dialog_id == dialog_id) {
|
if (dialog_nearby.dialog_id == dialog_id) {
|
||||||
@ -4941,11 +4942,16 @@ void ContactsManager::on_update_peer_located(vector<tl_object_ptr<telegram_api::
|
|||||||
}
|
}
|
||||||
if (!is_found) {
|
if (!is_found) {
|
||||||
users_nearby_.emplace_back(dialog_id, distance);
|
users_nearby_.emplace_back(dialog_id, distance);
|
||||||
|
all_users_nearby_.insert(dialog_id.get_user_id());
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto &dialogs_nearby = dialog_type == DialogType::User ? users_nearby_ : channels_nearby_;
|
if (dialog_type == DialogType::User) {
|
||||||
dialogs_nearby.emplace_back(dialog_id, distance);
|
users_nearby_.emplace_back(dialog_id, distance);
|
||||||
|
all_users_nearby_.insert(dialog_id.get_user_id());
|
||||||
|
} else {
|
||||||
|
channels_nearby_.emplace_back(dialog_id, distance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (need_update) {
|
if (need_update) {
|
||||||
@ -10966,7 +10972,7 @@ bool ContactsManager::is_user_status_exact(UserId user_id) const {
|
|||||||
|
|
||||||
bool ContactsManager::can_report_user(UserId user_id) const {
|
bool ContactsManager::can_report_user(UserId user_id) const {
|
||||||
auto u = get_user(user_id);
|
auto u = get_user(user_id);
|
||||||
return u != nullptr && !u->is_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 {
|
const ContactsManager::User *ContactsManager::get_user(UserId user_id) const {
|
||||||
|
@ -1425,6 +1425,7 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
vector<DialogNearby> users_nearby_;
|
vector<DialogNearby> users_nearby_;
|
||||||
vector<DialogNearby> channels_nearby_;
|
vector<DialogNearby> channels_nearby_;
|
||||||
|
std::unordered_set<UserId, UserIdHash> all_users_nearby_;
|
||||||
|
|
||||||
std::unordered_map<ChannelId, ChannelId, ChannelIdHash> linked_channel_ids_;
|
std::unordered_map<ChannelId, ChannelId, ChannelIdHash> linked_channel_ids_;
|
||||||
|
|
||||||
|
@ -6942,7 +6942,7 @@ void MessagesManager::report_dialog(DialogId dialog_id, const tl_object_ptr<td_a
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reason == nullptr) {
|
if (reason == nullptr) {
|
||||||
return promise.set_error(Status::Error(3, "Reason shouldn't be empty"));
|
return promise.set_error(Status::Error(3, "Reason must not be empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog *user_d = d;
|
Dialog *user_d = d;
|
||||||
|
@ -3509,7 +3509,7 @@ void StickersManager::reorder_installed_sticker_sets(bool is_masks, const vector
|
|||||||
|
|
||||||
Result<std::tuple<FileId, bool, bool>> StickersManager::prepare_input_sticker(td_api::inputSticker *sticker) {
|
Result<std::tuple<FileId, bool, bool>> StickersManager::prepare_input_sticker(td_api::inputSticker *sticker) {
|
||||||
if (sticker == nullptr) {
|
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_)) {
|
if (!clean_input_string(sticker->emojis_)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user