MM-40148: threadsOnly query param for user threads (#19833)

* MM-40148: threadsOnly query param for user threads

Currently we always calculate counts when fetching user threads.
Those counts include total, unread replies, and unread mentions,
and are potentially expensive to calculate.

This commit adds a new query param 'threadsOnly' which won't calculate
any counts and just return threads.

Co-authored-by: koox00 <3829551+koox00@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ashish Bhate
2022-04-04 17:50:13 +05:30
коммит произвёл GitHub
родитель 27bd16e5f5
Коммит 9521797b15
6 изменённых файлов: 149 добавлений и 34 удалений

Просмотреть файл

@@ -7813,6 +7813,12 @@ func (c *Client4) GetUserThreads(userId, teamId string, options GetUserThreadsOp
if options.Unread {
v.Set("unread", "true")
}
if options.ThreadsOnly {
v.Set("threadsOnly", "true")
}
if options.TotalsOnly {
v.Set("totalsOnly", "true")
}
url := c.userThreadsRoute(userId, teamId)
if len(v) > 0 {
url += "?" + v.Encode()

Просмотреть файл

@@ -67,6 +67,9 @@ type GetUserThreadsOpts struct {
// TotalsOnly will not fetch any threads and just fetch the total counts
TotalsOnly bool
// ThreadsOnly will fetch threads but not calculate totals and will return 0
ThreadsOnly bool
// TeamOnly will only fetch threads and unreads for the specified team and excludes DMs/GMs
TeamOnly bool
}