summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-01-26 11:51:27 -0500
committerJoramWilander <jwawilander@gmail.com>2016-01-26 11:51:27 -0500
commitfb794f03c136673378cb8af7c92cc0f307e55f73 (patch)
tree4680bfab66c6eb95338db1546f6d0f39cdcf3c44 /store
parent2b1b1e28e113f8a902f2e2f8d8a639acddbea316 (diff)
downloadchat-fb794f03c136673378cb8af7c92cc0f307e55f73.tar.gz
chat-fb794f03c136673378cb8af7c92cc0f307e55f73.tar.bz2
chat-fb794f03c136673378cb8af7c92cc0f307e55f73.zip
Update search query to ignore system messages
Diffstat (limited to 'store')
-rw-r--r--store/sql_post_store.go1
-rw-r--r--store/sql_post_store_test.go7
2 files changed, 8 insertions, 0 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index a2b18a163..2d5d66e0d 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -642,6 +642,7 @@ func (s SqlPostStore) Search(teamId string, userId string, params *model.SearchP
Posts
WHERE
DeleteAt = 0
+ AND Type NOT LIKE '` + model.POST_SYSTEM_MESSAGE_PREFIX + `%'
POST_FILTER
AND ChannelId IN (
SELECT
diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go
index a3e3e10dd..46b8d7678 100644
--- a/store/sql_post_store_test.go
+++ b/store/sql_post_store_test.go
@@ -676,6 +676,13 @@ func TestPostStoreSearch(t *testing.T) {
o1.Message = "corey mattermost new york"
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
+ o1a := &model.Post{}
+ o1a.ChannelId = c1.Id
+ o1a.UserId = model.NewId()
+ o1a.Message = "corey mattermost new york"
+ o1a.Type = model.POST_JOIN_LEAVE
+ o1a = (<-store.Post().Save(o1a)).Data.(*model.Post)
+
o2 := &model.Post{}
o2.ChannelId = c1.Id
o2.UserId = model.NewId()