[#196] added check to prevent error when getting visibility when it's missing (#198)

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
Camille Moussu
2025-10-08 11:28:55 +02:00
committed by GitHub
parent c86db8fa49
commit 9206fa8bab
@@ -143,16 +143,16 @@ interface AclEntry {
export function getCalendarVisibility(acl: AclEntry[]): "private" | "public" { export function getCalendarVisibility(acl: AclEntry[]): "private" | "public" {
let hasRead = false; let hasRead = false;
let hasFreeBusy = false; let hasFreeBusy = false;
if (acl) {
for (const entry of acl) {
if (entry.principal !== "{DAV:}authenticated") continue;
for (const entry of acl) { if (entry.privilege === "{DAV:}read") {
if (entry.principal !== "{DAV:}authenticated") continue; hasRead = true;
break; // highest visibility, can stop
if (entry.privilege === "{DAV:}read") { }
hasRead = true;
break; // highest visibility, can stop
} }
} }
if (hasRead) return "public"; if (hasRead) return "public";
return "private"; return "private";
} }