mirror of
https://github.com/paul-nameless/tg
synced 2024-11-22 03:43:19 +00:00
Merge pull request #7 from paul-nameless/fix-chats-duplicates
fix chat duplicates when small number of messages
This commit is contained in:
commit
3d55cb1e5d
1 changed files with 5 additions and 0 deletions
|
@ -97,10 +97,15 @@ class ChatModel:
|
|||
# return data from cache
|
||||
return self.chats[offset:limit]
|
||||
|
||||
previous_chats_num = len(self.chat_ids)
|
||||
|
||||
self.get_chat_ids(
|
||||
offset=len(self.chats),
|
||||
limit=len(self.chats) + limit
|
||||
)
|
||||
if len(self.chat_ids) == previous_chats_num:
|
||||
return self.chats[offset:limit]
|
||||
|
||||
for chat_id in self.chat_ids:
|
||||
chat = self.get_chat(chat_id)
|
||||
self.chats.append(chat)
|
||||
|
|
Loading…
Reference in a new issue