JMAP: Do not allow roles to be removed from system mailboxes (fixes 1977)

This commit is contained in:
mdecimus 2025-08-06 09:40:15 +02:00
parent 9403ef0748
commit d3b7c80a62

View file

@ -439,12 +439,13 @@ impl MailboxSet for Server {
let cached_mailboxes = self.get_cached_messages(ctx.account_id).await?;
// Verify that the mailbox role is unique.
if !matches!(changes.role, SpecialUse::None)
&& update
.as_ref()
.is_none_or(|(_, m)| m.inner.role != changes.role)
if update
.as_ref()
.is_none_or(|(_, m)| m.inner.role != changes.role)
{
if cached_mailboxes.mailbox_by_role(&changes.role).is_some() {
if !matches!(changes.role, SpecialUse::None)
&& cached_mailboxes.mailbox_by_role(&changes.role).is_some()
{
return Ok(Err(SetError::invalid_properties()
.with_property(Property::Role)
.with_description(format!(