From fb21c15f2294a68ec53d25bf27e61ed4752339cb Mon Sep 17 00:00:00 2001 From: Maurus Decimus <11444311+mdecimus@users.noreply.github.com> Date: Fri, 8 May 2026 08:49:14 +0200 Subject: [PATCH] Fix Registry: Reload `SieveUserScript` and `SieveSystemScript` entries after they are modified or deleted --- CHANGELOG.md | 1 + crates/jmap/src/registry/set.rs | 36 ++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f230ff6..a2ed88cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If - ACME: - Include apex domains when requesting certificates for subdomains. - Use the public suffix list to determine the zone name when no origin is provided. +- Registry: Reload `SieveUserScript` and `SieveSystemScript` entries after they are modified or deleted. ## [0.16.4] - 2026-05-05 diff --git a/crates/jmap/src/registry/set.rs b/crates/jmap/src/registry/set.rs index 0a4edb94..dcf1f70c 100644 --- a/crates/jmap/src/registry/set.rs +++ b/crates/jmap/src/registry/set.rs @@ -28,8 +28,11 @@ use crate::registry::{ }, }; use common::{ - Server, auth::AccessToken, cache::invalidate::CacheInvalidationBuilder, - expr::if_block::BootstrapExprExt, ipc::CacheInvalidation, + Server, + auth::AccessToken, + cache::invalidate::CacheInvalidationBuilder, + expr::if_block::BootstrapExprExt, + ipc::{BroadcastEvent, CacheInvalidation, RegistryChange}, }; use http_proto::HttpSessionData; use jmap_proto::{ @@ -656,9 +659,8 @@ impl RegistrySet for Server { .await .caused_by(trc::location!())? { - cache_invalidator.invalidate( - CacheInvalidation::AccessToken(sharee_id), - ); + cache_invalidator + .invalidate(CacheInvalidation::AccessToken(sharee_id)); } schedule_account_destruction(set.server, id, account).await?; @@ -679,6 +681,30 @@ impl RegistrySet for Server { // Finalize cache invalidation self.invalidate_caches(cache_invalidator).await?; + // Sieve scripts: refresh the in-memory compiled script maps + if matches!( + object_type, + ObjectType::SieveUserScript | ObjectType::SieveSystemScript + ) && (!set.response.created.is_empty() + || !set.response.updated.is_empty() + || !set.response.destroyed.is_empty()) + { + let result = Box::pin( + set.server + .reload_registry(RegistryChange::Reload(object_type)), + ) + .await?; + if !result.has_errors() { + set.server + .cluster_broadcast(BroadcastEvent::RegistryChange( + RegistryChange::Reload(object_type), + )) + .await; + } else { + result.log(); + } + } + Ok(set.into_response()) } ObjectType::ArfExternalReport