Skip to content

In-app unread message counter does not account for deleted messages #898

Description

@errom502

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.
1m

2m

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.

  1. Counting the number of unread messages.
    This action have to be in {get} query, when we receive subs meta of "me" topic. (
    func (t *Topic) replyGetSub(sess *Session, asUid types.Uid, authLevel auth.Level, asChan bool, msg *ClientComMessage) error {
    ). In that function we use MsgTopicSub structure, this structure has fields "ReadSeqId" and "SeqId".
    unread_Count = Seqid - ReadSeqid
  2. Counting the number of deleted messages: make query into db and take seq of messages between ReadSeqid and Seqid.
  3. Counting the correct number.
    unread_Count - numb_of_deleted_msg

Tinode version: master 0.22.10

Activity

  1. changed the title [-]changing the unread message counter[/-] [+]In-app unread message counter does not account for deleted messages[/+] on Feb 21, 2024
  2. or-else commented on Feb 21, 2024

    @or-else
    Contributor

    Yes, it's a known problem.

  3. AnthonyKot commented on Feb 16, 2025

    @AnthonyKot

    Tried to fix this in all places by this PR:
    #938

  4. AnthonyKot commented on Feb 17, 2025

    @AnthonyKot

    I attempted to reproduce the issue locally. @errom502, please correct me if my understanding is incorrect, but I've found that I can only remove UserA's messages from UserA's view. When I log in as UserB, those messages (which UserA removed using the right-click menu) are still visible from UserB view. Is there a "remove for all users" feature that I'm overlooking?

  5. or-else commented on Nov 7, 2025

    @or-else
    Contributor

    Partial fix on the server side mostly affecting iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions