aboutsummaryrefslogtreecommitdiffstats
path: root/worker/jmap/directories.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-06-24 14:42:00 +0200
committerRobin Jarry <robin@jarry.cc>2023-06-25 22:28:40 +0200
commitfb99486ad073bb99ca526add707d774464159e8a (patch)
tree32a2ee9f0ac57d827dbe441cc662bb00bb8fa367 /worker/jmap/directories.go
parentf7837edbb203a489fbfdd95f6b427906a58fbbdb (diff)
downloadaerc-fb99486ad073bb99ca526add707d774464159e8a.tar.gz
jmap: avoid displaying archive folder when use-labels=true
When archiving a message, the counts of archive folder are changed. When use-labels=true, the archive folder is hidden and should remain so. Do not send updates to the UI. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'worker/jmap/directories.go')
-rw-r--r--worker/jmap/directories.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/worker/jmap/directories.go b/worker/jmap/directories.go
index b3297169..0fa3d898 100644
--- a/worker/jmap/directories.go
+++ b/worker/jmap/directories.go
@@ -244,8 +244,15 @@ func (w *JMAPWorker) handleCreateDirectory(msg *types.CreateDirectory) error {
var req jmap.Request
var parentId, id jmap.ID
- if _, ok := w.dir2mbox[msg.Directory]; ok {
+ if id, ok := w.dir2mbox[msg.Directory]; ok {
// directory already exists
+ mbox, err := w.cache.GetMailbox(id)
+ if err != nil {
+ return err
+ }
+ if mbox.Role == mailbox.RoleArchive && w.config.useLabels {
+ return errNoop
+ }
return nil
}
if parent := path.Dir(msg.Directory); parent != "" && parent != "." {