MM-31713 Server/API: GetUserThread method (#16659)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Eli Yukelzon
2021-01-28 18:07:39 +02:00
коммит произвёл GitHub
родитель c14194d78b
Коммит 77da23e84b
14 изменённых файлов: 266 добавлений и 0 удалений

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

@@ -2371,6 +2371,19 @@ func (a *App) GetThreadsForUser(userId, teamId string, options model.GetUserThre
return threads, nil
}
func (a *App) GetThreadForUser(userId, teamId, threadId string, extended bool) (*model.ThreadResponse, *model.AppError) {
thread, err := a.Srv().Store.Thread().GetThreadForUser(userId, teamId, threadId, extended)
if err != nil {
return nil, model.NewAppError("GetThreadForUser", "app.user.get_threads_for_user.app_error", nil, err.Error(), http.StatusInternalServerError)
}
if thread == nil {
return nil, model.NewAppError("GetThreadForUser", "app.user.get_threads_for_user.not_found", nil, "thread not found/followed", http.StatusNotFound)
}
a.sanitizeProfiles(thread.Participants, false)
thread.Post.SanitizeProps()
return thread, nil
}
func (a *App) UpdateThreadsReadForUser(userId, teamId string) *model.AppError {
nErr := a.Srv().Store.Thread().MarkAllAsRead(userId, teamId)
if nErr != nil {