feat(conversations): align meta counts
This commit is contained in:
@@ -635,13 +635,25 @@ func (h *ConversationHandler) Meta(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
meta, svcErr := h.conversationSvc.GetMeta(c.Request.Context(), accountID)
|
||||
var params service.FilterParams
|
||||
if err := c.ShouldBindQuery(¶ms); err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
if params.Labels == "" {
|
||||
labels := append(c.QueryArray("labels"), c.QueryArray("labels[]")...)
|
||||
if len(labels) > 0 {
|
||||
params.Labels = strings.Join(labels, ",")
|
||||
}
|
||||
}
|
||||
|
||||
meta, svcErr := h.conversationSvc.GetMeta(c.Request.Context(), accountID, currentUserID(c), params)
|
||||
if svcErr != nil {
|
||||
handleServiceError(c, svcErr)
|
||||
return
|
||||
}
|
||||
|
||||
response.OK(c, meta)
|
||||
c.JSON(http.StatusOK, gin.H{"meta": meta})
|
||||
}
|
||||
|
||||
// Unread marks a conversation as unread by resetting agent_last_seen_at.
|
||||
|
||||
Reference in New Issue
Block a user