mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Prevent msg count subtraction to be less than zero (#5565)
This commit is contained in:
@@ -324,8 +324,11 @@ class TeamStoreClass extends EventEmitter {
|
||||
subtractUnread(teamId, msgs, mentions) {
|
||||
const member = this.my_team_members.filter((m) => m.team_id === teamId)[0];
|
||||
if (member) {
|
||||
member.msg_count -= msgs;
|
||||
member.mention_count -= mentions;
|
||||
const msgCount = member.msg_count - msgs;
|
||||
const mentionCount = member.mention_count - mentions;
|
||||
|
||||
member.msg_count = (msgCount > 0) ? msgCount : 0;
|
||||
member.mention_count = (mentionCount > 0) ? mentionCount : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user