summaryrefslogtreecommitdiffstats
path: root/store/sqlstore/post_store.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/sqlstore/post_store.go')
-rw-r--r--store/sqlstore/post_store.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/store/sqlstore/post_store.go b/store/sqlstore/post_store.go
index 229005b73..90db80796 100644
--- a/store/sqlstore/post_store.go
+++ b/store/sqlstore/post_store.go
@@ -803,6 +803,11 @@ func (s *SqlPostStore) Search(teamId string, userId string, params *model.Search
var posts []*model.Post
+ deletedQueryPart := "AND DeleteAt = 0"
+ if params.IncludeDeletedChannels {
+ deletedQueryPart = ""
+ }
+
searchQuery := `
SELECT
*
@@ -822,7 +827,7 @@ func (s *SqlPostStore) Search(teamId string, userId string, params *model.Search
Id = ChannelId
AND (TeamId = :TeamId OR TeamId = '')
AND UserId = :UserId
- AND DeleteAt = 0
+ ` + deletedQueryPart + `
CHANNEL_FILTER)
SEARCH_CLAUSE
ORDER BY CreateAt DESC