Open
Description
The change works correctly when the message is published, but when you publish a few messages and delete one or more messages, the counter doesn't change. Also if user1 is offline and user 2 does the same actions, when user 1 became online and he got incorrect counter anyway.
Possible server-side solution:
It's about case when user1 is offline and he needs to get correct unread msg count when he'll be online.
The problem of this solution is extra load on the database by one more query.
The result of this solution is correct unread count that can be send to the front-side.
- Counting the number of unread messages.
This action have to be in {get} query, when we receive subs meta of "me" topic. (Line 2351 in 99c6332
unread_Count = Seqid - ReadSeqid - Counting the number of deleted messages: make query into db and take seq of messages between ReadSeqid and Seqid.
- Counting the correct number.
unread_Count - numb_of_deleted_msg
Tinode version: master 0.22.10