fix: storage quota not shown with Stalwart #577

This commit is contained in:
Linus Rath
2026-07-07 20:35:37 +02:00
parent 9930d19ba4
commit db2c642d74
5 changed files with 17 additions and 6 deletions
+2 -1
View File
@@ -91,7 +91,8 @@ function StorageQuotaCircle({ quota, usagePercent }: { quota: { used: number; to
return () => document.removeEventListener("mousedown", handleClick);
}, [open, updatePosition]);
const free = quota.total - quota.used;
// Usage can legitimately exceed the quota (e.g. limit lowered after the fact)
const free = Math.max(0, quota.total - quota.used);
const strokeColor = usagePercent > 90
? "stroke-destructive"
: usagePercent > 70
+1 -1
View File
@@ -53,7 +53,7 @@ export function AccountSettings() {
const [dragOverIndex, setDragOverIndex] = useState<number | null>(null);
const draggedIndexRef = useRef<number | null>(null);
const quotaPercentage = quota ? Math.round((quota.used / quota.total) * 100) : 0;
const quotaPercentage = quota && quota.total > 0 ? Math.min(Math.round((quota.used / quota.total) * 100), 100) : 0;
const displayName = primaryIdentity?.name || account?.displayName || (isDemoMode ? 'Demo User' : undefined);
const email = primaryIdentity?.email || account?.email || username;
const max = getMaxAccounts();