MM-18623 - invalid reply-count displayed (#12364)

* fixed thread creator, fixed default behaviour of fetching posts
* handle reply-count in getPostThread code path
Этот коммит содержится в:
Eli Yukelzon
2019-10-10 17:14:44 +03:00
коммит произвёл GitHub
родитель 1635eb6006
Коммит 34b4bbcb46
6 изменённых файлов: 37 добавлений и 23 удалений

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

@@ -92,8 +92,8 @@ func (cfg *AutoPostCreator) CreateRandomPostNested(parentId, rootId string) (*mo
RootId: rootId,
Message: postText,
FileIds: fileIds}
rpost, err2 := cfg.client.CreatePost(post)
if err2 != nil {
rpost, resp := cfg.client.CreatePost(post)
if resp != nil && resp.Error != nil {
return nil, false
}
return rpost, true

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

@@ -466,7 +466,7 @@ func (api *PluginAPI) DeletePost(postId string) *model.AppError {
}
func (api *PluginAPI) GetPostThread(postId string) (*model.PostList, *model.AppError) {
return api.app.GetPostThread(postId)
return api.app.GetPostThread(postId, false)
}
func (api *PluginAPI) GetPost(postId string) (*model.Post, *model.AppError) {

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

@@ -167,7 +167,7 @@ func (a *App) CreatePost(post *model.Post, channel *model.Channel, triggerWebhoo
if len(post.RootId) > 0 {
pchan = make(chan store.StoreResult, 1)
go func() {
r, pErr := a.Srv.Store.Post().Get(post.RootId, true)
r, pErr := a.Srv.Store.Post().Get(post.RootId, false)
pchan <- store.StoreResult{Data: r, Err: pErr}
close(pchan)
}()
@@ -475,7 +475,7 @@ func (a *App) DeleteEphemeralPost(userId, postId string) {
func (a *App) UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model.AppError) {
post.SanitizeProps()
postLists, err := a.Srv.Store.Post().Get(post.Id, true)
postLists, err := a.Srv.Store.Post().Get(post.Id, false)
if err != nil {
return nil, err
}
@@ -634,8 +634,8 @@ func (a *App) GetSinglePost(postId string) (*model.Post, *model.AppError) {
return a.Srv.Store.Post().GetSingle(postId)
}
func (a *App) GetPostThread(postId string) (*model.PostList, *model.AppError) {
return a.Srv.Store.Post().Get(postId, false)
func (a *App) GetPostThread(postId string, skipFetchThreads bool) (*model.PostList, *model.AppError) {
return a.Srv.Store.Post().Get(postId, skipFetchThreads)
}
func (a *App) GetFlaggedPosts(userId string, offset int, limit int) (*model.PostList, *model.AppError) {
@@ -789,7 +789,7 @@ func (a *App) GetPostsForChannelAroundLastUnread(channelId, userId string, limit
return model.NewPostList(), nil
}
postList, err := a.GetPostThread(lastUnreadPostId)
postList, err := a.GetPostThread(lastUnreadPostId, false)
if err != nil {
return nil, err
}