From db26eb40e6878e2f5df783a1641656c944328dcc Mon Sep 17 00:00:00 2001
From: Pascal Bleser
Date: Tue, 21 Oct 2025 16:05:21 +0200
Subject: [PATCH] groupware: fix keyword patching syntax for markAsSeen=true
---
pkg/jmap/jmap_api_email.go | 5 +----
pkg/jmap/jmap_model.go | 2 +-
services/groupware/pkg/groupware/groupware_api_emails.go | 1 +
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/pkg/jmap/jmap_api_email.go b/pkg/jmap/jmap_api_email.go
index 5bdc032cf6..2f55f28627 100644
--- a/pkg/jmap/jmap_api_email.go
+++ b/pkg/jmap/jmap_api_email.go
@@ -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}
diff --git a/pkg/jmap/jmap_model.go b/pkg/jmap/jmap_model.go
index d66f89f4ca..fd1e8a09b2 100644
--- a/pkg/jmap/jmap_model.go
+++ b/pkg/jmap/jmap_model.go
@@ -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`.
diff --git a/services/groupware/pkg/groupware/groupware_api_emails.go b/services/groupware/pkg/groupware/groupware_api_emails.go
index 5ba0829a21..7082fc72b9 100644
--- a/services/groupware/pkg/groupware/groupware_api_emails.go
+++ b/services/groupware/pkg/groupware/groupware_api_emails.go
@@ -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 {