groupware: fix keyword patching syntax for markAsSeen=true

This commit is contained in:
Pascal Bleser
2025-10-21 16:05:21 +02:00
parent 1061c348a5
commit db26eb40e6
3 changed files with 3 additions and 5 deletions

View File

@@ -43,12 +43,9 @@ func (j *Client) GetEmails(accountId string, session *Session, ctx context.Conte
methodCalls := []Invocation{invokeGet}
if markAsSeen {
patch := map[string]bool{
JmapKeywordSeen: true,
}
updates := make(map[string]EmailUpdate, len(ids))
for _, id := range ids {
updates[id] = EmailUpdate{"keywords": patch}
updates[id] = EmailUpdate{"keywords/" + JmapKeywordSeen: true}
}
mark := EmailSetCommand{AccountId: accountId, Update: updates}
methodCalls = []Invocation{invocation(CommandEmailSet, mark, "0"), invokeGet}

View File

@@ -2854,7 +2854,7 @@ type EmailSetCommand struct {
//
// The value associated with each pointer determines how to apply that patch:
// !- If null, set to the default value if specified for this property; otherwise, remove the property from the patched object. If the key is not present in the parent, this a no-op.
// ç- Anything else: The value to set for this property (this may be a replacement or addition to the object being patched).
// !- Anything else: The value to set for this property (this may be a replacement or addition to the object being patched).
//
// Any server-set properties MAY be included in the patch if their value is identical to the current server value
// (before applying the patches to the object). Otherwise, the update MUST be rejected with an `invalidProperties` `SetError`.

View File

@@ -1012,6 +1012,7 @@ func (g *Groupware) UpdateEmailKeywords(w http.ResponseWriter, r *http.Request)
return noContentResponse(req.session.State)
}
// TODO FIXME use "keywords/$seen" instead, see https://datatracker.ietf.org/doc/html/rfc8620#section-5.7
patch := map[string]*bool{}
truth := true
for _, keyword := range body.Add {