From f9608d383c3f6fe27b3719b4ce3b5db29477aa03 Mon Sep 17 00:00:00 2001 From: Kyriakos Z <3829551+koox00@users.noreply.github.com> Date: Thu, 28 Oct 2021 11:51:37 +0300 Subject: [PATCH] MM-39041: expose TotalsOnly option (#18767) Sending a request to GetThreadsForUser for a TotalsOnly returns just the counts without any threads. --- api4/user.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/api4/user.go b/api4/user.go index 7372d9a6e5..0235b6baae 100644 --- a/api4/user.go +++ b/api4/user.go @@ -2982,13 +2982,14 @@ func getThreadsForUser(c *Context, w http.ResponseWriter, r *http.Request) { } options := model.GetUserThreadsOpts{ - Since: 0, - Before: "", - After: "", - PageSize: uint64(c.Params.PerPage), - Unread: false, - Extended: false, - Deleted: false, + Since: 0, + Before: "", + After: "", + PageSize: uint64(c.Params.PerPage), + Unread: false, + Extended: false, + Deleted: false, + TotalsOnly: false, } sinceString := r.URL.Query().Get("since") @@ -3012,10 +3013,12 @@ func getThreadsForUser(c *Context, w http.ResponseWriter, r *http.Request) { deletedStr := r.URL.Query().Get("deleted") unreadStr := r.URL.Query().Get("unread") extendedStr := r.URL.Query().Get("extended") + totalsOnlyStr := r.URL.Query().Get("totalsOnly") options.Deleted, _ = strconv.ParseBool(deletedStr) options.Unread, _ = strconv.ParseBool(unreadStr) options.Extended, _ = strconv.ParseBool(extendedStr) + options.TotalsOnly, _ = strconv.ParseBool(totalsOnlyStr) threads, err := c.App.GetThreadsForUser(c.Params.UserId, c.Params.TeamId, options) if err != nil {