Fix issue with setting mention count (#11610)

This change does the following:
 - Fixes a bug where mention counts could be set incorrectly for
   users in the database.
 - Updates the original notification unit test to check for more
   possible notification issues.
 - Adds a new unit test that performs mention count checking to
   prevent a regression to this fix.
Этот коммит содержится в:
Gabe Jackson
2019-07-11 18:35:02 -04:00
коммит произвёл GitHub
родитель 5ed40a48c8
Коммит 48e06e9bc4
2 изменённых файлов: 83 добавлений и 45 удалений

Просмотреть файл

@@ -182,10 +182,10 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
for id := range mentionedUserIds {
mentionedUsersList = append(mentionedUsersList, id)
umc := make(chan *model.AppError, 1)
go func() {
umc <- a.Srv.Store.Channel().IncrementMentionCount(post.ChannelId, id)
go func(userId string) {
umc <- a.Srv.Store.Channel().IncrementMentionCount(post.ChannelId, userId)
close(umc)
}()
}(id)
updateMentionChans = append(updateMentionChans, umc)
}