summaryrefslogtreecommitdiffstats
path: root/app/post.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-07-31 19:45:35 +0100
committerChristopher Speller <crspeller@gmail.com>2017-07-31 11:45:35 -0700
commit25a2013890c7e07b4621fa9b18342e7f35363049 (patch)
treed9bf133c9da460138ad5d2aab9683436f92e8290 /app/post.go
parent8a91235fb3cdc8d094dbc2eaa0d7baa447132b3c (diff)
downloadchat-25a2013890c7e07b4621fa9b18342e7f35363049.tar.gz
chat-25a2013890c7e07b4621fa9b18342e7f35363049.tar.bz2
chat-25a2013890c7e07b4621fa9b18342e7f35363049.zip
PLT-6603: Don't return all posts on invalid query. (#7061)
If the query contains only * or invalid punctuation only components, don't return all posts - instead return no results. This also fixes PLT-6608
Diffstat (limited to 'app/post.go')
-rw-r--r--app/post.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/post.go b/app/post.go
index c40eab0e8..ee28fbbf7 100644
--- a/app/post.go
+++ b/app/post.go
@@ -532,6 +532,11 @@ func SearchPostsInTeam(terms string, userId string, teamId string, isOrSearch bo
}
}
+ // If the processed search params are empty, return empty search results.
+ if len(finalParamsList) == 0 {
+ return model.NewPostList(), nil
+ }
+
// We only allow the user to search in channels they are a member of.
userChannels, err := GetChannelsForUser(teamId, userId)
if err != nil {