MM-33359 corrected unread replies update (#17068)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Eli Yukelzon
2021-03-09 16:10:47 +02:00
коммит произвёл GitHub
родитель 024bc97a5d
Коммит 90e7c5a852
12 изменённых файлов: 142 добавлений и 95 удалений

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

@@ -183,16 +183,10 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
mac := make(chan *model.AppError, 1)
go func(userID string) {
defer close(mac)
incrementMentions := false
for mid := range mentions.Mentions {
if userID == mid {
incrementMentions = true
break
}
}
nErr := a.Srv().Store.Thread().CreateMembershipIfNeeded(userID, post.RootId, true, incrementMentions, *a.Config().ServiceSettings.ThreadAutoFollow)
if nErr != nil {
mac <- model.NewAppError("SendNotifications", "app.channel.autofollow.app_error", nil, nErr.Error(), http.StatusInternalServerError)
_, incrementMentions := mentions.Mentions[userID]
err := a.Srv().Store.Thread().MaintainMembership(userID, post.RootId, true, incrementMentions, *a.Config().ServiceSettings.ThreadAutoFollow, userID == post.UserId)
if err != nil {
mac <- model.NewAppError("SendNotifications", "app.channel.autofollow.app_error", nil, err.Error(), http.StatusInternalServerError)
return
}
@@ -439,7 +433,6 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
sendEvent = preference.Value == "on"
}
if sendEvent {
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_THREAD_UPDATED, team.Id, "", uid, nil)
userThread, _ := a.Srv().Store.Thread().GetThreadForUser(uid, channel.TeamId, thread.PostId, true)
a.sanitizeProfiles(userThread.Participants, false)