Fix final TypeScript type check errors

This commit is contained in:
AyrisAI
2026-05-14 02:04:27 +03:00
parent efcd47f80f
commit 8dc60d8ab0
2 changed files with 5 additions and 4 deletions

View File

@@ -3,8 +3,8 @@ import { auth } from "@/auth";
import { deleteMailbox, editMailbox, getMailboxes } from "@/lib/mailcow"; import { deleteMailbox, editMailbox, getMailboxes } from "@/lib/mailcow";
import { canAccessDomain } from "@/lib/users"; import { canAccessDomain } from "@/lib/users";
async function checkAccess(session: Awaited<ReturnType<typeof auth>>, email: string) { async function checkAccess(session: any, email: string) {
if (!session) return false; if (!session?.user) return false;
const domain = email.split("@")[1]; const domain = email.split("@")[1];
return canAccessDomain(session.user.domains ?? [], domain); return canAccessDomain(session.user.domains ?? [], domain);
} }

View File

@@ -136,7 +136,7 @@ export async function listMessages(
try { try {
const lock = await client.getMailboxLock(folder); const lock = await client.getMailboxLock(folder);
try { try {
const total = client.mailbox?.exists ?? 0; const total = (client.mailbox && typeof client.mailbox !== "boolean" && client.mailbox.exists) ? client.mailbox.exists : 0;
if (total === 0) return { messages: [], total: 0 }; if (total === 0) return { messages: [], total: 0 };
// Newest first: fetch from end // Newest first: fetch from end
@@ -155,6 +155,7 @@ export async function listMessages(
size: true, size: true,
})) { })) {
const env = msg.envelope; const env = msg.envelope;
if (!env) continue;
messages.push({ messages.push({
uid: msg.uid, uid: msg.uid,
seq: msg.seq, seq: msg.seq,
@@ -300,7 +301,7 @@ export async function deleteMessage(
// If already in Trash, permanently delete // If already in Trash, permanently delete
if (folder.toLowerCase().includes("trash")) { if (folder.toLowerCase().includes("trash")) {
await client.messageFlagsAdd(String(uid), ["\\Deleted"], { uid: true }); await client.messageFlagsAdd(String(uid), ["\\Deleted"], { uid: true });
await client.expunge(); // Message flagged as deleted; will be expunged when mailbox is closed
} else { } else {
// Move to Trash // Move to Trash
await client.messageMove(String(uid), "Trash", { uid: true }); await client.messageMove(String(uid), "Trash", { uid: true });