Improve getting groups in common.
GitOrigin-RevId: 211d8706823b9aa509af00855083a1981a0a963a
This commit is contained in:
parent
6d2842d0b4
commit
0181982749
@ -7123,6 +7123,10 @@ void ContactsManager::on_update_user_common_chat_count(UserId user_id, int32 com
|
|||||||
void ContactsManager::on_update_user_full_common_chat_count(UserFull *user_full, UserId user_id,
|
void ContactsManager::on_update_user_full_common_chat_count(UserFull *user_full, UserId user_id,
|
||||||
int32 common_chat_count) {
|
int32 common_chat_count) {
|
||||||
CHECK(user_full != nullptr);
|
CHECK(user_full != nullptr);
|
||||||
|
if (common_chat_count < 0) {
|
||||||
|
LOG(ERROR) << "Receive " << common_chat_count << " as common group count with " << user_id;
|
||||||
|
common_chat_count = 0;
|
||||||
|
}
|
||||||
if (user_full->is_inited && user_full->common_chat_count != common_chat_count) {
|
if (user_full->is_inited && user_full->common_chat_count != common_chat_count) {
|
||||||
user_full->common_chat_count = common_chat_count;
|
user_full->common_chat_count = common_chat_count;
|
||||||
user_full->is_common_chat_count_changed = true;
|
user_full->is_common_chat_count_changed = true;
|
||||||
|
@ -11876,6 +11876,7 @@ void MessagesManager::on_get_common_dialogs(UserId user_id, int32 offset_chat_id
|
|||||||
if (!result.empty() && result.back() == DialogId()) {
|
if (!result.empty() && result.back() == DialogId()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
bool is_last = chats.empty() && offset_chat_id == 0;
|
||||||
for (auto &chat : chats) {
|
for (auto &chat : chats) {
|
||||||
DialogId dialog_id;
|
DialogId dialog_id;
|
||||||
switch (chat->get_id()) {
|
switch (chat->get_id()) {
|
||||||
@ -11940,7 +11941,7 @@ void MessagesManager::on_get_common_dialogs(UserId user_id, int32 offset_chat_id
|
|||||||
result.push_back(dialog_id);
|
result.push_back(dialog_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result.size() >= static_cast<size_t>(total_count)) {
|
if (result.size() >= static_cast<size_t>(total_count) || is_last) {
|
||||||
result.push_back(DialogId());
|
result.push_back(DialogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23510,8 +23511,8 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
old_type != MessageContentType::ExpiredPhoto && old_type != MessageContentType::ExpiredVideo) {
|
old_type != MessageContentType::ExpiredPhoto && old_type != MessageContentType::ExpiredVideo) {
|
||||||
LOG(ERROR) << message_id << " in " << dialog_id << " has changed contains_mention from "
|
LOG(ERROR) << message_id << " in " << dialog_id << " has changed contains_mention from "
|
||||||
<< old_message->contains_mention << " to " << new_message->contains_mention
|
<< old_message->contains_mention << " to " << new_message->contains_mention
|
||||||
<< ", is_outgoing = " << old_message->is_outgoing << ", message content type is "
|
<< ", is_outgoing = " << old_message->is_outgoing << ", message content type is " << old_type << '/'
|
||||||
<< old_type << '/' << new_message->content->get_type();
|
<< new_message->content->get_type();
|
||||||
}
|
}
|
||||||
// contains_mention flag shouldn't be changed, because the message will not be added to unread mention list
|
// contains_mention flag shouldn't be changed, because the message will not be added to unread mention list
|
||||||
// and we are unable to show/hide message notification
|
// and we are unable to show/hide message notification
|
||||||
|
@ -2896,7 +2896,8 @@ void StickersManager::on_get_archived_sticker_sets(
|
|||||||
// if 0 sticker sets are received then set offset_sticker_set_id was found and there is no stickers after it
|
// if 0 sticker sets are received then set offset_sticker_set_id was found and there is no stickers after it
|
||||||
// or it wasn't found and there is no archived sets at all
|
// or it wasn't found and there is no archived sets at all
|
||||||
bool is_last =
|
bool is_last =
|
||||||
sticker_sets.empty() && (offset_sticker_set_id == 0 || offset_sticker_set_id == sticker_set_ids.back());
|
sticker_sets.empty() &&
|
||||||
|
(offset_sticker_set_id == 0 || (!sticker_set_ids.empty() && offset_sticker_set_id == sticker_set_ids.back()));
|
||||||
|
|
||||||
total_archived_sticker_set_count_[is_masks] = total_count;
|
total_archived_sticker_set_count_[is_masks] = total_count;
|
||||||
for (auto &sticker_set_covered : sticker_sets) {
|
for (auto &sticker_set_covered : sticker_sets) {
|
||||||
|
Reference in New Issue
Block a user