In this example UserA sent "Hello" via DM to UserB. UserB has yet to read the message, so the mentionCount is 1, and the MsgCount is 0 for UserB.
| ChannelId | Username | MsgCount. | MentionCount |
|---|---|---|---|
| k7az1dt6nig67kgdcgfyxbn4we | UserA | 1 | 0 |
| k7az1dt6nig67kgdcgfyxbn4we | UserB | 0 | 1 |
The moment UserB reads the message it changes the mentionCount to 0 and the MsgCount to 1 for UserB, and the row for UserA remains unchanged since no reply has been sent.
| ChannelId | Username | MsgCount. | MentionCount |
|---|---|---|---|
| k7az1dt6nig67kgdcgfyxbn4we | UserA | 1 | 0 |
| k7az1dt6nig67kgdcgfyxbn4we | UserB | 1 | 0 |
Now, when UserB sends "Hey" back to UserA we see the below happen. msgCount for UserB goes to 2 since there are now two messages that UserB has read. UserA has an increase in MentionCount by 1 and msgCount remains at 1 because they have yet to read the message.
| ChannelId | Username | MsgCount. | MentionCount |
|---|---|---|---|
| k7az1dt6nig67kgdcgfyxbn4we | UserA | 1 | 1 |
| k7az1dt6nig67kgdcgfyxbn4we | UserB | 2 | 0 |
Finally, UserA reads that message which sets their mentionCount to 0 since all messages are read and it increases their msgCount to 2 since there are 2 total messages in that channel.
| ChannelId | Username | MsgCount. | MentionCount |
|---|---|---|---|
| k7az1dt6nig67kgdcgfyxbn4we | UserA | 2 | 0 |
| k7az1dt6nig67kgdcgfyxbn4we | UserB | 2 | 0 |