Add source to get_user_force.
This commit is contained in:
parent
999aaaf610
commit
a3e277f7c0
@ -6172,7 +6172,7 @@ void ContactsManager::set_my_online_status(bool is_online, bool send_update, boo
|
||||
}
|
||||
|
||||
auto my_id = get_my_id();
|
||||
User *u = get_user_force(my_id);
|
||||
User *u = get_user_force(my_id, "set_my_online_status");
|
||||
if (u != nullptr) {
|
||||
int32 new_online;
|
||||
int32 now = G()->unix_time();
|
||||
@ -6232,7 +6232,7 @@ UserId ContactsManager::get_service_notifications_user_id() {
|
||||
|
||||
UserId ContactsManager::add_service_notifications_user() {
|
||||
auto user_id = get_service_notifications_user_id();
|
||||
if (!have_user_force(user_id)) {
|
||||
if (!have_user_force(user_id, "add_service_notifications_user")) {
|
||||
LOG(FATAL) << "Failed to load service notification user";
|
||||
}
|
||||
return user_id;
|
||||
@ -6256,7 +6256,7 @@ UserId ContactsManager::get_anti_spam_bot_user_id() {
|
||||
|
||||
UserId ContactsManager::add_anonymous_bot_user() {
|
||||
auto user_id = get_anonymous_bot_user_id();
|
||||
if (!have_user_force(user_id)) {
|
||||
if (!have_user_force(user_id, "add_anonymous_bot_user")) {
|
||||
LOG(FATAL) << "Failed to load anonymous bot user";
|
||||
}
|
||||
return user_id;
|
||||
@ -6264,7 +6264,7 @@ UserId ContactsManager::add_anonymous_bot_user() {
|
||||
|
||||
UserId ContactsManager::add_channel_bot_user() {
|
||||
auto user_id = get_channel_bot_user_id();
|
||||
if (!have_user_force(user_id)) {
|
||||
if (!have_user_force(user_id, "add_channel_bot_user")) {
|
||||
LOG(FATAL) << "Failed to load channel bot user";
|
||||
}
|
||||
return user_id;
|
||||
@ -6448,7 +6448,7 @@ int64 ContactsManager::get_contacts_hash() {
|
||||
vector<int64> user_ids = contacts_hints_.search_empty(100000).second;
|
||||
CHECK(std::is_sorted(user_ids.begin(), user_ids.end()));
|
||||
auto my_id = get_my_id();
|
||||
const User *u = get_user_force(my_id);
|
||||
const User *u = get_user_force(my_id, "get_contacts_hash");
|
||||
if (u != nullptr && u->is_contact) {
|
||||
user_ids.insert(std::upper_bound(user_ids.begin(), user_ids.end(), my_id.get()), my_id.get());
|
||||
}
|
||||
@ -7480,7 +7480,7 @@ void ContactsManager::on_update_bot_menu_button(UserId bot_user_id,
|
||||
LOG(ERROR) << "Receive updateBotCOmmands about invalid " << bot_user_id;
|
||||
return;
|
||||
}
|
||||
if (!have_user_force(bot_user_id) || !is_user_bot(bot_user_id)) {
|
||||
if (!have_user_force(bot_user_id, "on_update_bot_menu_button") || !is_user_bot(bot_user_id)) {
|
||||
return;
|
||||
}
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
@ -9021,7 +9021,7 @@ void ContactsManager::transfer_dialog_ownership(DialogId dialog_id, UserId user_
|
||||
if (!td_->messages_manager_->have_dialog_force(dialog_id, "transfer_dialog_ownership")) {
|
||||
return promise.set_error(Status::Error(400, "Chat not found"));
|
||||
}
|
||||
if (!have_user_force(user_id)) {
|
||||
if (!have_user_force(user_id, "transfer_dialog_ownership")) {
|
||||
return promise.set_error(Status::Error(400, "User not found"));
|
||||
}
|
||||
if (is_user_bot(user_id)) {
|
||||
@ -10252,7 +10252,7 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
||||
}
|
||||
LOG(INFO) << "Receive empty " << user_id << " from " << source;
|
||||
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, source);
|
||||
if (u == nullptr && Slice(source) != Slice("GetUsersQuery")) {
|
||||
// userEmpty should be received only through getUsers for nonexistent users
|
||||
LOG(ERROR) << "Have no information about " << user_id << ", but received userEmpty from " << source;
|
||||
@ -10289,13 +10289,13 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
||||
if (!is_received) {
|
||||
// we must preload received inaccessible users from database in order to not save
|
||||
// the min-user to the database and to not override access_hash and another info
|
||||
if (!have_user_force(user_id)) {
|
||||
if (!have_user_force(user_id, "on_get_user 2")) {
|
||||
LOG(INFO) << "Receive inaccessible " << user_id;
|
||||
}
|
||||
} else if (is_contact && !are_contacts_loaded_) {
|
||||
// preload contact users from database to know that is_contact didn't changed
|
||||
// and the list of contacts doesn't need to be saved to the database
|
||||
if (!have_user_force(user_id)) {
|
||||
if (!have_user_force(user_id, "on_get_user 3")) {
|
||||
LOG(INFO) << "Receive contact " << user_id << " for the first time";
|
||||
}
|
||||
}
|
||||
@ -10701,12 +10701,12 @@ void ContactsManager::on_load_user_from_database(UserId user_id, string value, b
|
||||
set_promises(promises);
|
||||
}
|
||||
|
||||
bool ContactsManager::have_user_force(UserId user_id) {
|
||||
return get_user_force(user_id) != nullptr;
|
||||
bool ContactsManager::have_user_force(UserId user_id, const char *source) {
|
||||
return get_user_force(user_id, source) != nullptr;
|
||||
}
|
||||
|
||||
ContactsManager::User *ContactsManager::get_user_force(UserId user_id) {
|
||||
auto u = get_user_force_impl(user_id);
|
||||
ContactsManager::User *ContactsManager::get_user_force(UserId user_id, const char *source) {
|
||||
auto u = get_user_force_impl(user_id, source);
|
||||
if ((u == nullptr || !u->is_received) &&
|
||||
(user_id == get_service_notifications_user_id() || user_id == get_replies_bot_user_id() ||
|
||||
user_id == get_anonymous_bot_user_id() || user_id == get_channel_bot_user_id() ||
|
||||
@ -10791,7 +10791,7 @@ ContactsManager::User *ContactsManager::get_user_force(UserId user_id) {
|
||||
return u;
|
||||
}
|
||||
|
||||
ContactsManager::User *ContactsManager::get_user_force_impl(UserId user_id) {
|
||||
ContactsManager::User *ContactsManager::get_user_force_impl(UserId user_id, const char *source) {
|
||||
if (!user_id.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -10807,7 +10807,7 @@ ContactsManager::User *ContactsManager::get_user_force_impl(UserId user_id) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Trying to load " << user_id << " from database";
|
||||
LOG(INFO) << "Trying to load " << user_id << " from database from " << source;
|
||||
on_load_user_from_database(user_id, G()->td_db()->get_sqlite_sync_pmc()->get(get_user_database_key(user_id)), true);
|
||||
return get_user(user_id);
|
||||
}
|
||||
@ -11534,7 +11534,7 @@ void ContactsManager::on_load_secret_chat_from_database(SecretChatId secret_chat
|
||||
}
|
||||
|
||||
// TODO load users asynchronously
|
||||
if (c != nullptr && !have_user_force(c->user_id)) {
|
||||
if (c != nullptr && !have_user_force(c->user_id, "on_load_secret_chat_from_database")) {
|
||||
LOG(ERROR) << "Can't find " << c->user_id << " from " << secret_chat_id;
|
||||
}
|
||||
|
||||
@ -11552,7 +11552,7 @@ ContactsManager::SecretChat *ContactsManager::get_secret_chat_force(SecretChatId
|
||||
|
||||
SecretChat *c = get_secret_chat(secret_chat_id);
|
||||
if (c != nullptr) {
|
||||
if (!have_user_force(c->user_id)) {
|
||||
if (!have_user_force(c->user_id, "get_secret_chat_force")) {
|
||||
LOG(ERROR) << "Can't find " << c->user_id << " from " << secret_chat_id;
|
||||
}
|
||||
return c;
|
||||
@ -11645,7 +11645,7 @@ void ContactsManager::on_load_user_full_from_database(UserId user_id, string val
|
||||
}
|
||||
|
||||
ContactsManager::UserFull *ContactsManager::get_user_full_force(UserId user_id) {
|
||||
if (!have_user_force(user_id)) {
|
||||
if (!have_user_force(user_id, "get_user_full_force")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -12862,7 +12862,7 @@ vector<BotCommands> ContactsManager::get_bot_commands(vector<tl_object_ptr<teleg
|
||||
}
|
||||
|
||||
auto user_id = UserId(bot_info->user_id_);
|
||||
const User *u = get_user_force(user_id);
|
||||
const User *u = get_user_force(user_id, "get_bot_commands");
|
||||
if (u == nullptr) {
|
||||
LOG(ERROR) << "Receive unknown " << user_id;
|
||||
continue;
|
||||
@ -13299,7 +13299,7 @@ void ContactsManager::on_update_user_name(UserId user_id, string &&first_name, s
|
||||
return;
|
||||
}
|
||||
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, "on_update_user_name");
|
||||
if (u != nullptr) {
|
||||
on_update_user_name(u, user_id, std::move(first_name), std::move(last_name));
|
||||
on_update_user_usernames(u, user_id, std::move(usernames));
|
||||
@ -13343,7 +13343,7 @@ void ContactsManager::on_update_user_phone_number(UserId user_id, string &&phone
|
||||
return;
|
||||
}
|
||||
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, "on_update_user_phone_number");
|
||||
if (u != nullptr) {
|
||||
on_update_user_phone_number(u, user_id, std::move(phone_number));
|
||||
update_user(u, user_id);
|
||||
@ -13500,7 +13500,7 @@ void ContactsManager::on_update_user_emoji_status(UserId user_id,
|
||||
return;
|
||||
}
|
||||
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, "on_update_user_emoji_status");
|
||||
if (u != nullptr) {
|
||||
on_update_user_emoji_status(u, user_id, EmojiStatus(std::move(emoji_status)));
|
||||
update_user(u, user_id);
|
||||
@ -13526,7 +13526,7 @@ void ContactsManager::on_update_user_has_stories(UserId user_id, bool has_storie
|
||||
return;
|
||||
}
|
||||
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, "on_update_user_has_stories");
|
||||
if (u != nullptr) {
|
||||
on_update_user_has_stories(u, user_id, has_stories, max_active_story_id, max_read_story_id);
|
||||
update_user(u, user_id);
|
||||
@ -13607,7 +13607,7 @@ void ContactsManager::on_update_user_stories_hidden(UserId user_id, bool stories
|
||||
return;
|
||||
}
|
||||
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, "on_update_user_stories_hidden");
|
||||
if (u != nullptr) {
|
||||
on_update_user_stories_hidden(u, user_id, stories_hidden);
|
||||
update_user(u, user_id);
|
||||
@ -13660,7 +13660,7 @@ void ContactsManager::on_update_user_online(UserId user_id, tl_object_ptr<telegr
|
||||
return;
|
||||
}
|
||||
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, "on_update_user_online");
|
||||
if (u != nullptr) {
|
||||
if (u->is_bot) {
|
||||
LOG(ERROR) << "Receive updateUserStatus about bot " << user_id;
|
||||
@ -13742,7 +13742,7 @@ void ContactsManager::on_update_user_online(User *u, UserId user_id, tl_object_p
|
||||
void ContactsManager::on_update_user_local_was_online(UserId user_id, int32 local_was_online) {
|
||||
CHECK(user_id.is_valid());
|
||||
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, "on_update_user_local_was_online");
|
||||
if (u == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -13963,7 +13963,7 @@ void ContactsManager::add_set_profile_photo_to_cache(UserId user_id, Photo &&pho
|
||||
// we have subsequence of user photos in user_photos_
|
||||
// ProfilePhoto in User and Photo in UserFull
|
||||
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, "add_set_profile_photo_to_cache");
|
||||
if (u == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -14052,7 +14052,7 @@ bool ContactsManager::delete_my_profile_photo_from_cache(int64 profile_photo_id)
|
||||
LOG(INFO) << "Delete profile photo " << profile_photo_id << " from cache";
|
||||
|
||||
auto user_id = get_my_id();
|
||||
User *u = get_user_force(user_id);
|
||||
User *u = get_user_force(user_id, "delete_my_profile_photo_from_cache");
|
||||
bool is_main_photo_deleted = u != nullptr && u->photo.id == profile_photo_id;
|
||||
|
||||
// update photo list
|
||||
@ -16386,7 +16386,7 @@ void ContactsManager::on_update_bot_stopped(UserId user_id, int32 date, bool is_
|
||||
LOG(ERROR) << "Receive updateBotStopped by non-bot";
|
||||
return;
|
||||
}
|
||||
if (date <= 0 || !have_user_force(user_id)) {
|
||||
if (date <= 0 || !have_user_force(user_id, "on_update_bot_stopped")) {
|
||||
LOG(ERROR) << "Receive invalid updateBotStopped by " << user_id << " at " << date;
|
||||
return;
|
||||
}
|
||||
@ -16512,7 +16512,7 @@ void ContactsManager::on_update_channel_participant(ChannelId channel_id, UserId
|
||||
|
||||
void ContactsManager::on_update_chat_invite_requester(DialogId dialog_id, UserId user_id, string about, int32 date,
|
||||
DialogInviteLink invite_link) {
|
||||
if (!td_->auth_manager_->is_bot() || date <= 0 || !have_user_force(user_id) ||
|
||||
if (!td_->auth_manager_->is_bot() || date <= 0 || !have_user_force(user_id, "on_update_chat_invite_requester") ||
|
||||
!td_->messages_manager_->have_dialog_info_force(dialog_id)) {
|
||||
LOG(ERROR) << "Receive invalid updateBotChatInviteRequester by " << user_id << " in " << dialog_id << " at "
|
||||
<< date;
|
||||
@ -16719,7 +16719,7 @@ void ContactsManager::send_get_me_query(Td *td, Promise<Unit> &&promise) {
|
||||
|
||||
UserId ContactsManager::get_me(Promise<Unit> &&promise) {
|
||||
auto my_id = get_my_id();
|
||||
if (!have_user_force(my_id)) {
|
||||
if (!have_user_force(my_id, "get_me")) {
|
||||
send_get_me_query(td_, std::move(promise));
|
||||
return UserId();
|
||||
}
|
||||
@ -16737,7 +16737,7 @@ bool ContactsManager::get_user(UserId user_id, int left_tries, Promise<Unit> &&p
|
||||
if (user_id == get_service_notifications_user_id() || user_id == get_replies_bot_user_id() ||
|
||||
user_id == get_anonymous_bot_user_id() || user_id == get_channel_bot_user_id() ||
|
||||
user_id == get_anti_spam_bot_user_id()) {
|
||||
get_user_force(user_id);
|
||||
get_user_force(user_id, "get_user");
|
||||
}
|
||||
|
||||
if (td_->auth_manager_->is_bot() ? !have_user(user_id) : !have_min_user(user_id)) {
|
||||
@ -16795,7 +16795,7 @@ void ContactsManager::reload_user(UserId user_id, Promise<Unit> &&promise) {
|
||||
return promise.set_error(Status::Error(400, "Invalid user identifier"));
|
||||
}
|
||||
|
||||
have_user_force(user_id);
|
||||
have_user_force(user_id, "reload_user");
|
||||
|
||||
TRY_STATUS_PROMISE(promise, get_input_user(user_id));
|
||||
|
||||
@ -17001,7 +17001,7 @@ void ContactsManager::on_get_user_profile_photos(UserId user_id, Result<Unit> &&
|
||||
}
|
||||
|
||||
void ContactsManager::reload_user_profile_photo(UserId user_id, int64 photo_id, Promise<Unit> &&promise) {
|
||||
get_user_force(user_id);
|
||||
get_user_force(user_id, "reload_user_profile_photo");
|
||||
TRY_RESULT_PROMISE(promise, input_user, get_input_user(user_id));
|
||||
|
||||
// this request will be needed only to download the photo,
|
||||
@ -19353,7 +19353,7 @@ tl_object_ptr<td_api::secretChat> ContactsManager::get_secret_chat_object(Secret
|
||||
if (secret_chat == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
get_user_force(secret_chat->user_id);
|
||||
get_user_force(secret_chat->user_id, "get_secret_chat_object");
|
||||
return get_secret_chat_object_const(secret_chat_id, secret_chat);
|
||||
}
|
||||
|
||||
|
@ -578,7 +578,7 @@ class ContactsManager final : public Actor {
|
||||
|
||||
bool have_user(UserId user_id) const;
|
||||
bool have_min_user(UserId user_id) const;
|
||||
bool have_user_force(UserId user_id);
|
||||
bool have_user_force(UserId user_id, const char *source);
|
||||
|
||||
bool is_dialog_info_received_from_server(DialogId dialog_id) const;
|
||||
|
||||
@ -1329,8 +1329,8 @@ class ContactsManager final : public Actor {
|
||||
|
||||
const User *get_user(UserId user_id) const;
|
||||
User *get_user(UserId user_id);
|
||||
User *get_user_force(UserId user_id);
|
||||
User *get_user_force_impl(UserId user_id);
|
||||
User *get_user_force(UserId user_id, const char *source);
|
||||
User *get_user_force_impl(UserId user_id, const char *source);
|
||||
|
||||
User *add_user(UserId user_id, const char *source);
|
||||
|
||||
|
@ -92,7 +92,7 @@ void Dependencies::add_message_sender_dependencies(DialogId dialog_id) {
|
||||
bool Dependencies::resolve_force(Td *td, const char *source) const {
|
||||
bool success = true;
|
||||
for (auto user_id : user_ids) {
|
||||
if (!td->contacts_manager_->have_user_force(user_id)) {
|
||||
if (!td->contacts_manager_->have_user_force(user_id, source)) {
|
||||
LOG(ERROR) << "Can't find " << user_id << " from " << source;
|
||||
success = false;
|
||||
}
|
||||
|
@ -2639,7 +2639,7 @@ void GroupCallManager::join_group_call(GroupCallId group_call_id, DialogId as_di
|
||||
if (as_dialog_id != my_dialog_id) {
|
||||
return promise.set_error(Status::Error(400, "Can't join voice chat as another user"));
|
||||
}
|
||||
if (!td_->contacts_manager_->have_user_force(as_dialog_id.get_user_id())) {
|
||||
if (!td_->contacts_manager_->have_user_force(as_dialog_id.get_user_id(), "join_group_call")) {
|
||||
have_as_dialog_id = false;
|
||||
}
|
||||
} else {
|
||||
|
@ -140,7 +140,7 @@ Result<DialogId> get_message_sender_dialog_id(Td *td,
|
||||
}
|
||||
return Status::Error(400, "Invalid user identifier specified");
|
||||
}
|
||||
bool know_user = td->contacts_manager_->have_user_force(user_id);
|
||||
bool know_user = td->contacts_manager_->have_user_force(user_id, "get_message_sender_dialog_id");
|
||||
if (check_access && !know_user) {
|
||||
return Status::Error(400, "Unknown user identifier specified");
|
||||
}
|
||||
@ -154,9 +154,10 @@ Result<DialogId> get_message_sender_dialog_id(Td *td,
|
||||
}
|
||||
return Status::Error(400, "Invalid chat identifier specified");
|
||||
}
|
||||
bool know_dialog = dialog_id.get_type() == DialogType::User
|
||||
? td->contacts_manager_->have_user_force(dialog_id.get_user_id())
|
||||
: td->messages_manager_->have_dialog_force(dialog_id, "get_message_sender_dialog_id");
|
||||
bool know_dialog =
|
||||
dialog_id.get_type() == DialogType::User
|
||||
? td->contacts_manager_->have_user_force(dialog_id.get_user_id(), "get_message_sender_dialog_id 2")
|
||||
: td->messages_manager_->have_dialog_force(dialog_id, "get_message_sender_dialog_id");
|
||||
if (check_access && !know_dialog) {
|
||||
return Status::Error(400, "Unknown chat identifier specified");
|
||||
}
|
||||
|
@ -6425,7 +6425,7 @@ bool MessagesManager::have_dialog_info_force(DialogId dialog_id) const {
|
||||
switch (dialog_id.get_type()) {
|
||||
case DialogType::User: {
|
||||
UserId user_id = dialog_id.get_user_id();
|
||||
return td_->contacts_manager_->have_user_force(user_id);
|
||||
return td_->contacts_manager_->have_user_force(user_id, "have_dialog_info_force");
|
||||
}
|
||||
case DialogType::Chat: {
|
||||
ChatId chat_id = dialog_id.get_chat_id();
|
||||
@ -18214,7 +18214,7 @@ void MessagesManager::on_get_message_viewers(DialogId dialog_id, MessageViewers
|
||||
if (!is_recursive) {
|
||||
bool need_participant_list = false;
|
||||
for (auto user_id : message_viewers.get_user_ids()) {
|
||||
if (!td_->contacts_manager_->have_user_force(user_id)) {
|
||||
if (!td_->contacts_manager_->have_user_force(user_id, "on_get_message_viewers")) {
|
||||
need_participant_list = true;
|
||||
}
|
||||
}
|
||||
@ -19527,7 +19527,8 @@ Status MessagesManager::toggle_message_sender_is_blocked(const td_api::object_pt
|
||||
break;
|
||||
case DialogType::SecretChat: {
|
||||
auto user_id = td_->contacts_manager_->get_secret_chat_user_id(dialog_id.get_secret_chat_id());
|
||||
if (!user_id.is_valid() || !td_->contacts_manager_->have_user_force(user_id)) {
|
||||
if (!user_id.is_valid() ||
|
||||
!td_->contacts_manager_->have_user_force(user_id, "toggle_message_sender_is_blocked")) {
|
||||
return Status::Error(400, "The secret chat can't be blocked");
|
||||
}
|
||||
dialog_id = DialogId(user_id);
|
||||
@ -32289,7 +32290,8 @@ void MessagesManager::on_update_dialog_default_join_group_call_as_dialog_id(Dial
|
||||
if (default_join_as_dialog_id.is_valid()) {
|
||||
if (default_join_as_dialog_id.get_type() != DialogType::User) {
|
||||
force_create_dialog(default_join_as_dialog_id, "on_update_dialog_default_join_group_call_as_dialog_id");
|
||||
} else if (!td_->contacts_manager_->have_user_force(default_join_as_dialog_id.get_user_id()) ||
|
||||
} else if (!td_->contacts_manager_->have_user_force(default_join_as_dialog_id.get_user_id(),
|
||||
"on_update_dialog_default_join_group_call_as_dialog_id") ||
|
||||
default_join_as_dialog_id != get_my_dialog_id()) {
|
||||
default_join_as_dialog_id = DialogId();
|
||||
}
|
||||
@ -32329,7 +32331,8 @@ void MessagesManager::on_update_dialog_default_send_message_as_dialog_id(DialogI
|
||||
if (default_send_as_dialog_id.is_valid()) {
|
||||
if (default_send_as_dialog_id.get_type() != DialogType::User) {
|
||||
force_create_dialog(default_send_as_dialog_id, "on_update_dialog_default_send_message_as_dialog_id");
|
||||
} else if (!td_->contacts_manager_->have_user_force(default_send_as_dialog_id.get_user_id()) ||
|
||||
} else if (!td_->contacts_manager_->have_user_force(default_send_as_dialog_id.get_user_id(),
|
||||
"on_update_dialog_default_send_message_as_dialog_id") ||
|
||||
default_send_as_dialog_id != get_my_dialog_id()) {
|
||||
default_send_as_dialog_id = DialogId();
|
||||
}
|
||||
@ -39352,7 +39355,7 @@ void MessagesManager::on_binlog_events(vector<BinlogEvent> &&events) {
|
||||
dependencies.resolve_force(td_, "SendBotStartMessageLogEvent");
|
||||
|
||||
auto bot_user_id = log_event.bot_user_id;
|
||||
if (!td_->contacts_manager_->have_user_force(bot_user_id)) {
|
||||
if (!td_->contacts_manager_->have_user_force(bot_user_id, "SendBotStartMessageLogEvent")) {
|
||||
LOG(ERROR) << "Can't find bot " << bot_user_id;
|
||||
binlog_erase(G()->td_db()->get_binlog(), event.id_);
|
||||
continue;
|
||||
@ -39886,7 +39889,8 @@ void MessagesManager::on_binlog_events(vector<BinlogEvent> &&events) {
|
||||
|
||||
auto dialog_id = log_event.dialog_id_;
|
||||
bool have_info = dialog_id.get_type() == DialogType::User
|
||||
? td_->contacts_manager_->have_user_force(dialog_id.get_user_id())
|
||||
? td_->contacts_manager_->have_user_force(dialog_id.get_user_id(),
|
||||
"ToggleDialogIsMarkedAsUnreadOnServerLogEvent")
|
||||
: have_dialog_force(dialog_id, "ToggleDialogIsMarkedAsUnreadOnServerLogEvent");
|
||||
if (!have_info || !have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
binlog_erase(G()->td_db()->get_binlog(), event.id_);
|
||||
|
@ -3384,7 +3384,8 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
|
||||
arg = std::move(loc_args[0]);
|
||||
}
|
||||
|
||||
if (sender_user_id.is_valid() && !td_->contacts_manager_->have_user_force(sender_user_id)) {
|
||||
if (sender_user_id.is_valid() &&
|
||||
!td_->contacts_manager_->have_user_force(sender_user_id, "process_push_notification_payload")) {
|
||||
int64 sender_access_hash = -1;
|
||||
telegram_api::object_ptr<telegram_api::UserProfilePhoto> sender_photo;
|
||||
TRY_RESULT(mtpeer, get_json_object_field(custom, "mtpeer", JsonValue::Type::Object));
|
||||
@ -3761,7 +3762,8 @@ void NotificationManager::add_message_push_notification(DialogId dialog_id, Mess
|
||||
CHECK(log_event_id != 0);
|
||||
}
|
||||
|
||||
if (sender_user_id.is_valid() && !td_->contacts_manager_->have_user_force(sender_user_id)) {
|
||||
if (sender_user_id.is_valid() &&
|
||||
!td_->contacts_manager_->have_user_force(sender_user_id, "add_message_push_notification")) {
|
||||
int32 flags = USER_FLAG_IS_INACCESSIBLE;
|
||||
auto user_name = sender_user_id.get() == 136817688 ? "Channel" : sender_name;
|
||||
auto user = telegram_api::make_object<telegram_api::user>(
|
||||
|
@ -668,7 +668,8 @@ void UpdatesManager::set_date(int32 date, bool from_update, string date_source)
|
||||
}
|
||||
|
||||
bool UpdatesManager::is_acceptable_user(UserId user_id) const {
|
||||
return td_->contacts_manager_->have_user_force(user_id) && td_->contacts_manager_->have_user(user_id);
|
||||
return td_->contacts_manager_->have_user_force(user_id, "is_acceptable_user") &&
|
||||
td_->contacts_manager_->have_user(user_id);
|
||||
}
|
||||
|
||||
bool UpdatesManager::is_acceptable_chat(ChatId chat_id) const {
|
||||
|
Loading…
Reference in New Issue
Block a user