summaryrefslogtreecommitdiffstats
path: root/app/post.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-10-09 18:14:27 +0100
committerChris <ccbrown112@gmail.com>2017-10-09 10:14:27 -0700
commit0da0cf1a21d7dea61f4459ee71bf01b6ca362aee (patch)
tree8f8f1d539bc9f8b3126dddbd896c615dee300e15 /app/post.go
parent2a76eeeeee9acdd9aaebc3ec94a40254b933c966 (diff)
downloadchat-0da0cf1a21d7dea61f4459ee71bf01b6ca362aee.tar.gz
chat-0da0cf1a21d7dea61f4459ee71bf01b6ca362aee.tar.bz2
chat-0da0cf1a21d7dea61f4459ee71bf01b6ca362aee.zip
PLT-7826: Don't fetch posts from store if ES returns none. (#7596)
Diffstat (limited to 'app/post.go')
-rw-r--r--app/post.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/post.go b/app/post.go
index 497cab5a6..4a465450b 100644
--- a/app/post.go
+++ b/app/post.go
@@ -602,12 +602,14 @@ func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOr
// Get the posts
postList := model.NewPostList()
- if presult := <-a.Srv.Store.Post().GetPostsByIds(postIds); presult.Err != nil {
- return nil, presult.Err
- } else {
- for _, p := range presult.Data.([]*model.Post) {
- postList.AddPost(p)
- postList.AddOrder(p.Id)
+ if len(postIds) > 0 {
+ if presult := <-a.Srv.Store.Post().GetPostsByIds(postIds); presult.Err != nil {
+ return nil, presult.Err
+ } else {
+ for _, p := range presult.Data.([]*model.Post) {
+ postList.AddPost(p)
+ postList.AddOrder(p.Id)
+ }
}
}