MM-15843 migrating post.GetSingle() to sync by default (#10992)
Этот коммит содержится в:
коммит произвёл
Hanzei
родитель
8ff58a07bd
Коммит
427effcd5c
23
app/post.go
23
app/post.go
@@ -627,11 +627,7 @@ func (a *App) GetPostsSince(channelId string, time int64) (*model.PostList, *mod
|
||||
}
|
||||
|
||||
func (a *App) GetSinglePost(postId string) (*model.Post, *model.AppError) {
|
||||
result := <-a.Srv.Store.Post().GetSingle(postId)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
}
|
||||
return result.Data.(*model.Post), nil
|
||||
return a.Srv.Store.Post().GetSingle(postId)
|
||||
}
|
||||
|
||||
func (a *App) GetPostThread(postId string) (*model.PostList, *model.AppError) {
|
||||
@@ -709,12 +705,11 @@ func (a *App) GetPostsAroundPost(postId, channelId string, offset, limit int, be
|
||||
}
|
||||
|
||||
func (a *App) DeletePost(postId, deleteByID string) (*model.Post, *model.AppError) {
|
||||
result := <-a.Srv.Store.Post().GetSingle(postId)
|
||||
if result.Err != nil {
|
||||
result.Err.StatusCode = http.StatusBadRequest
|
||||
return nil, result.Err
|
||||
post, err := a.Srv.Store.Post().GetSingle(postId)
|
||||
if err != nil {
|
||||
err.StatusCode = http.StatusBadRequest
|
||||
return nil, err
|
||||
}
|
||||
post := result.Data.(*model.Post)
|
||||
|
||||
channel, err := a.GetChannel(post.ChannelId)
|
||||
if err != nil {
|
||||
@@ -945,7 +940,13 @@ func (a *App) SearchPostsInTeamForUser(terms string, userId string, teamId strin
|
||||
}
|
||||
|
||||
func (a *App) GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo, *model.AppError) {
|
||||
pchan := a.Srv.Store.Post().GetSingle(postId)
|
||||
|
||||
pchan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
post, err := a.Srv.Store.Post().GetSingle(postId)
|
||||
pchan <- store.StoreResult{Data: post, Err: err}
|
||||
close(pchan)
|
||||
}()
|
||||
|
||||
infos, err := a.GetFileInfosForPost(postId, false)
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user