Send updateChatOnlineMemberCount with 0 after chat is closed.

GitOrigin-RevId: cb5c91783cc235b340f8274cfb76ffe0b68e474a
This commit is contained in:
levlam 2019-03-02 22:18:40 +03:00
parent a4ab41f8f8
commit 03de2b47e8
2 changed files with 4 additions and 2 deletions

View File

@ -2387,7 +2387,7 @@ updateChatReplyMarkup chat_id:int53 reply_markup_message_id:int53 = Update;
//@description A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied @chat_id Chat identifier @draft_message The new draft message; may be null @order New value of the chat order
updateChatDraftMessage chat_id:int53 draft_message:draftMessage order:int64 = Update;
//@description The number of online group members has changed. This update is sent only for currently open chats. There is no guarantee that it will be sent just after the count has changed @chat_id Identifier of the chat @online_member_count New number of online members in the chat, or 0 if unknown
//@description The number of online group members has changed. This update with non-zero count is sent only for currently opened chats. There is no guarantee that it will be sent just after the count has changed @chat_id Identifier of the chat @online_member_count New number of online members in the chat, or 0 if unknown
updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update;
//@description A notification was changed @notification_group_id Unique notification group identifier @notification Changed notification

View File

@ -8599,6 +8599,7 @@ void MessagesManager::on_update_dialog_online_member_count_timeout(DialogId dial
Dialog *d = get_dialog(dialog_id);
CHECK(d != nullptr);
if (!d->is_opened) {
send_update_chat_online_member_count(dialog_id, 0);
return;
}
@ -13032,7 +13033,8 @@ void MessagesManager::close_dialog(Dialog *d) {
auto &info = online_count_it->second;
info.is_update_sent = false;
}
update_dialog_online_member_count_timeout_.cancel_timeout(d->dialog_id.get());
update_dialog_online_member_count_timeout_.set_timeout_in(d->dialog_id.get(),
ONLINE_MEMBER_COUNT_CACHE_EXPIRE_TIME);
}
}