3
0

Thread filter now returns only threads current user created or replied to

This commit is contained in:
Denis Arh
2019-01-03 22:01:17 +01:00
parent a83c1ed3e6
commit ec9a08b42e

View File

@@ -57,6 +57,8 @@ const (
" AND rel_channel IN " + sqlChannelAccess +
" AND reply_to = 0 " +
" AND replies > 0 " +
// for finding only threads we've created or replied to
" AND (rel_user = ? OR id IN (SELECT DISTINCT reply_to FROM messages WHERE rel_user = ?))" +
" ORDER BY id DESC " +
" LIMIT ? " +
")" +
@@ -176,6 +178,9 @@ func (r *message) FindThreads(filter *types.MessageFilter) (types.MessageSet, er
// for sqlChannelAccess
params = append(params, filter.CurrentUserID, types.ChannelTypePublic)
// for finding only threads we've created or replied to
params = append(params, filter.CurrentUserID, filter.CurrentUserID)
// for sqlMessagesThreads
params = append(params, filter.Limit)