Skip to content

Instantly share code, notes, and snippets.

@coltoneshaw
Last active December 15, 2020 14:43
Show Gist options
  • Save coltoneshaw/0878c11667f6221606b7a23282bc10ea to your computer and use it in GitHub Desktop.
Save coltoneshaw/0878c11667f6221606b7a23282bc10ea to your computer and use it in GitHub Desktop.
Mattermost ChannelMember Mention & MsgCount Explanation

UserA Sends "Hello" to UserB

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

UserB Reads UserA's Message

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

UserB Sends "Hey" Back

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

UserA Reads UserB's Message

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment