groupware: add missing total,limit,offset attributes in the QueryEmailsSummaries response

This commit is contained in:
Pascal Bleser
2025-10-23 15:19:14 +02:00
parent bea38ffb7c
commit a56d2d2f7f
2 changed files with 18 additions and 5 deletions

View File

@@ -185,7 +185,6 @@ func (j *Client) GetAllEmailsInMailbox(accountId string, session *Session, ctx c
Total: queryResponse.Total,
Limit: queryResponse.Limit,
Offset: queryResponse.Position,
State: getResponse.State,
}, nil
})
}
@@ -930,6 +929,9 @@ func (j *Client) EmailsInThread(accountId string, threadId string, session *Sess
type EmailsSummary struct {
Emails []Email `json:"emails"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
State State `json:"state"`
}
@@ -993,16 +995,22 @@ func (j *Client) QueryEmailSummaries(accountIds []string, session *Session, ctx
}
cmd, err := j.request(session, logger, invocations...)
if err != nil {
return map[string]EmailsSummary{}, "", "", err
return nil, "", "", err
}
return command(j.api, logger, ctx, session, j.onSessionOutdated, cmd, acceptLanguage, func(body *Response) (map[string]EmailsSummary, Error) {
resp := map[string]EmailsSummary{}
for _, accountId := range uniqueAccountIds {
var queryResponse EmailQueryResponse
err = retrieveResponseMatchParameters(logger, body, CommandEmailQuery, mcid(accountId, "0"), &queryResponse)
if err != nil {
return nil, err
}
var response EmailGetResponse
err = retrieveResponseMatchParameters(logger, body, CommandEmailGet, mcid(accountId, "1"), &response)
if err != nil {
return map[string]EmailsSummary{}, err
return nil, err
}
if len(response.NotFound) > 0 {
// TODO what to do when there are not-found emails here? potentially nothing, they could have been deleted between query and get?
@@ -1016,7 +1024,13 @@ func (j *Client) QueryEmailSummaries(accountIds []string, session *Session, ctx
setThreadSize(&thread, response.List)
}
resp[accountId] = EmailsSummary{Emails: response.List, State: response.State}
resp[accountId] = EmailsSummary{
Emails: response.List,
Total: int(queryResponse.Total),
Limit: int(queryResponse.Limit),
Offset: int(queryResponse.Position),
State: response.State,
}
}
return resp, nil
})

View File

@@ -131,7 +131,6 @@ func (g *Groupware) GetAllEmailsInMailbox(w http.ResponseWriter, r *http.Request
Total: emails.Total,
Limit: emails.Limit,
Offset: emails.Offset,
State: emails.State,
}
return etagResponse(safe, sessionState, emails.State, lang)