Silence warning about changed dialog order if dialog info was received from serverr.
GitOrigin-RevId: b6211153533746180307542d3e19fcd10aac63d2
This commit is contained in:
parent
7fd495a69c
commit
23ad80e3a9
@ -7043,6 +7043,7 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
|||||||
u->cache_version = User::CACHE_VERSION;
|
u->cache_version = User::CACHE_VERSION;
|
||||||
u->need_save_to_database = true;
|
u->need_save_to_database = true;
|
||||||
}
|
}
|
||||||
|
u->is_received_from_server = true;
|
||||||
update_user(u, user_id);
|
update_user(u, user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11516,6 +11517,25 @@ ContactsManager::User *ContactsManager::get_user(UserId user_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ContactsManager::is_dialog_info_received_from_server(DialogId dialog_id) const {
|
||||||
|
switch (dialog_id.get_type()) {
|
||||||
|
case DialogType::User: {
|
||||||
|
auto u = get_user(dialog_id.get_user_id());
|
||||||
|
return u != nullptr && u->is_received_from_server;
|
||||||
|
}
|
||||||
|
case DialogType::Chat: {
|
||||||
|
auto c = get_chat(dialog_id.get_chat_id());
|
||||||
|
return c != nullptr && c->is_received_from_server;
|
||||||
|
}
|
||||||
|
case DialogType::Channel: {
|
||||||
|
auto c = get_channel(dialog_id.get_channel_id());
|
||||||
|
return c != nullptr && c->is_received_from_server;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::reload_dialog_info(DialogId dialog_id, Promise<Unit> &&promise) {
|
void ContactsManager::reload_dialog_info(DialogId dialog_id, Promise<Unit> &&promise) {
|
||||||
switch (dialog_id.get_type()) {
|
switch (dialog_id.get_type()) {
|
||||||
case DialogType::User:
|
case DialogType::User:
|
||||||
@ -12879,6 +12899,7 @@ void ContactsManager::on_chat_update(telegram_api::chat &chat, const char *sourc
|
|||||||
c->cache_version = Chat::CACHE_VERSION;
|
c->cache_version = Chat::CACHE_VERSION;
|
||||||
c->need_save_to_database = true;
|
c->need_save_to_database = true;
|
||||||
}
|
}
|
||||||
|
c->is_received_from_server = true;
|
||||||
update_chat(c, chat_id);
|
update_chat(c, chat_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12909,6 +12930,7 @@ void ContactsManager::on_chat_update(telegram_api::chatForbidden &chat, const ch
|
|||||||
c->cache_version = Chat::CACHE_VERSION;
|
c->cache_version = Chat::CACHE_VERSION;
|
||||||
c->need_save_to_database = true;
|
c->need_save_to_database = true;
|
||||||
}
|
}
|
||||||
|
c->is_received_from_server = true;
|
||||||
update_chat(c, chat_id);
|
update_chat(c, chat_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13055,6 +13077,7 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
|
|||||||
c->cache_version = Channel::CACHE_VERSION;
|
c->cache_version = Channel::CACHE_VERSION;
|
||||||
c->need_save_to_database = true;
|
c->need_save_to_database = true;
|
||||||
}
|
}
|
||||||
|
c->is_received_from_server = true;
|
||||||
update_channel(c, channel_id);
|
update_channel(c, channel_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13140,6 +13163,7 @@ void ContactsManager::on_chat_update(telegram_api::channelForbidden &channel, co
|
|||||||
c->cache_version = Channel::CACHE_VERSION;
|
c->cache_version = Channel::CACHE_VERSION;
|
||||||
c->need_save_to_database = true;
|
c->need_save_to_database = true;
|
||||||
}
|
}
|
||||||
|
c->is_received_from_server = true;
|
||||||
update_channel(c, channel_id);
|
update_channel(c, channel_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,6 +422,8 @@ class ContactsManager : public Actor {
|
|||||||
bool have_min_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);
|
||||||
|
|
||||||
|
bool is_dialog_info_received_from_server(DialogId dialog_id) const;
|
||||||
|
|
||||||
void reload_dialog_info(DialogId dialog_id, Promise<Unit> &&promise);
|
void reload_dialog_info(DialogId dialog_id, Promise<Unit> &&promise);
|
||||||
|
|
||||||
static void send_get_me_query(Td *td, Promise<Unit> &&promise);
|
static void send_get_me_query(Td *td, Promise<Unit> &&promise);
|
||||||
@ -608,6 +610,8 @@ class ContactsManager : public Actor {
|
|||||||
bool is_being_saved = false; // is current user being saved to the database
|
bool is_being_saved = false; // is current user being saved to the database
|
||||||
bool is_status_saved = false; // is current user status being saved/is saved to the database
|
bool is_status_saved = false; // is current user status being saved/is saved to the database
|
||||||
|
|
||||||
|
bool is_received_from_server = false; // true, if the user was received from the server and not the database
|
||||||
|
|
||||||
uint64 logevent_id = 0;
|
uint64 logevent_id = 0;
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
@ -696,6 +700,9 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
bool is_saved = false; // is current chat version being saved/is saved to the database
|
bool is_saved = false; // is current chat version being saved/is saved to the database
|
||||||
bool is_being_saved = false; // is current chat being saved to the database
|
bool is_being_saved = false; // is current chat being saved to the database
|
||||||
|
|
||||||
|
bool is_received_from_server = false; // true, if the chat was received from the server and not the database
|
||||||
|
|
||||||
uint64 logevent_id = 0;
|
uint64 logevent_id = 0;
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
@ -765,6 +772,9 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
bool is_saved = false; // is current channel version being saved/is saved to the database
|
bool is_saved = false; // is current channel version being saved/is saved to the database
|
||||||
bool is_being_saved = false; // is current channel being saved to the database
|
bool is_being_saved = false; // is current channel being saved to the database
|
||||||
|
|
||||||
|
bool is_received_from_server = false; // true, if the channel was received from the server and not the database
|
||||||
|
|
||||||
uint64 logevent_id = 0;
|
uint64 logevent_id = 0;
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
@ -839,6 +849,7 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
bool is_saved = false; // is current secret chat version being saved/is saved to the database
|
bool is_saved = false; // is current secret chat version being saved/is saved to the database
|
||||||
bool is_being_saved = false; // is current secret chat being saved to the database
|
bool is_being_saved = false; // is current secret chat being saved to the database
|
||||||
|
|
||||||
uint64 logevent_id = 0;
|
uint64 logevent_id = 0;
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
|
@ -28182,7 +28182,8 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_dialog_pos(d, "fix_new_dialog 7", true, is_loaded_from_database);
|
update_dialog_pos(d, "fix_new_dialog 7", true, is_loaded_from_database);
|
||||||
if (is_loaded_from_database && d->order != order && order < get_dialog_order({}, MIN_PINNED_DIALOG_DATE - 1)) {
|
if (is_loaded_from_database && d->order != order && order < get_dialog_order({}, MIN_PINNED_DIALOG_DATE - 1) &&
|
||||||
|
!td_->contacts_manager_->is_dialog_info_received_from_server(dialog_id)) {
|
||||||
LOG(ERROR) << dialog_id << " has order " << d->order << " instead of saved to database order " << order;
|
LOG(ERROR) << dialog_id << " has order " << d->order << " instead of saved to database order " << order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user