MM-30970 Add Basic unreadMentions support for collapsed threads (#16407)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Eli Yukelzon
2020-12-01 17:20:23 +02:00
коммит произвёл GitHub
родитель 1bd7dc41bd
Коммит c2036f614e
14 изменённых файлов: 330 добавлений и 66 удалений

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

@@ -2384,9 +2384,9 @@ func (a *App) GetThreadsForUser(userId string, options model.GetUserThreadsOpts)
}
func (a *App) UpdateThreadsReadForUser(userId string, timestamp int64) *model.AppError {
err := a.Srv().Store.Thread().MarkAllAsRead(userId, timestamp)
if err != nil {
return model.NewAppError("UpdateThreadsReadForUser", "app.user.update_threads_read_for_user.app_error", nil, err.Error(), http.StatusInternalServerError)
nErr := a.Srv().Store.Thread().MarkAllAsRead(userId, timestamp)
if nErr != nil {
return model.NewAppError("UpdateThreadsReadForUser", "app.user.update_threads_read_for_user.app_error", nil, nErr.Error(), http.StatusInternalServerError)
}
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_THREAD_READ_CHANGED, "", "", userId, nil)
message.Add("timestamp", timestamp)
@@ -2395,7 +2395,7 @@ func (a *App) UpdateThreadsReadForUser(userId string, timestamp int64) *model.Ap
}
func (a *App) UpdateThreadFollowForUser(userId, threadId string, state bool) *model.AppError {
err := a.Srv().Store.Thread().CreateMembershipIfNeeded(userId, threadId, state)
err := a.Srv().Store.Thread().CreateMembershipIfNeeded(userId, threadId, state, false, true)
if err != nil {
return model.NewAppError("UpdateThreadFollowForUser", "app.user.update_thread_follow_for_user.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -2407,9 +2407,9 @@ func (a *App) UpdateThreadFollowForUser(userId, threadId string, state bool) *mo
}
func (a *App) UpdateThreadReadForUser(userId, threadId string, timestamp int64) *model.AppError {
err := a.Srv().Store.Thread().MarkAsRead(userId, threadId, timestamp)
if err != nil {
return model.NewAppError("UpdateThreadReadForUser", "app.user.update_thread_read_for_user.app_error", nil, err.Error(), http.StatusInternalServerError)
nErr := a.Srv().Store.Thread().MarkAsRead(userId, threadId, timestamp)
if nErr != nil {
return model.NewAppError("UpdateThreadReadForUser", "app.user.update_thread_read_for_user.app_error", nil, nErr.Error(), http.StatusInternalServerError)
}
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_THREAD_READ_CHANGED, "", "", userId, nil)
message.Add("thread_id", threadId)