mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-09-12 06:54:34 +08:00
Invalidate logo cache when changes are made (fixes #1856)
This commit is contained in:
parent
0dcaadb668
commit
ede01a92c2
2 changed files with 11 additions and 2 deletions
|
@ -912,7 +912,7 @@ impl Type {
|
|||
1 => Type::Group,
|
||||
2 => Type::Resource,
|
||||
3 => Type::Location,
|
||||
4 => Type::Individual, // legacy
|
||||
4 => Type::Other, // legacy
|
||||
5 => Type::List,
|
||||
6 => Type::Other,
|
||||
7 => Type::Domain,
|
||||
|
|
|
@ -572,6 +572,7 @@ impl PrincipalManager for Server {
|
|||
})?;
|
||||
|
||||
// Validate changes
|
||||
let mut invalidate_logo_cache = false;
|
||||
for change in &changes {
|
||||
match change.field {
|
||||
PrincipalField::Secrets
|
||||
|
@ -581,13 +582,16 @@ impl PrincipalManager for Server {
|
|||
| PrincipalField::UsedQuota
|
||||
| PrincipalField::Description
|
||||
| PrincipalField::Type
|
||||
| PrincipalField::Picture
|
||||
| PrincipalField::MemberOf
|
||||
| PrincipalField::Members
|
||||
| PrincipalField::Lists
|
||||
| PrincipalField::Urls
|
||||
| PrincipalField::ExternalMembers
|
||||
| PrincipalField::Locale => (),
|
||||
PrincipalField::Picture => {
|
||||
invalidate_logo_cache |=
|
||||
matches!(typ, Type::Domain | Type::Tenant);
|
||||
}
|
||||
PrincipalField::Tenant => {
|
||||
// Tenants are not allowed to change their tenantId
|
||||
if access_token.tenant.is_some() {
|
||||
|
@ -671,6 +675,11 @@ impl PrincipalManager for Server {
|
|||
// Increment revision
|
||||
self.invalidate_principal_caches(changed_principals).await;
|
||||
|
||||
// Invalidate logo cache if needed
|
||||
if invalidate_logo_cache {
|
||||
self.inner.data.logos.lock().clear();
|
||||
}
|
||||
|
||||
Ok(JsonResponse::new(json!({
|
||||
"data": (),
|
||||
}))
|
||||
|
|
Loading…
Add table
Reference in a new issue