Merge pull request #4 from killerprojecte/main
Docker Release / Check web and api (push) Waiting to run
Docker Release / Resolve release tag (push) Blocked by required conditions
Docker Release / Build and publish all-in-one (push) Blocked by required conditions
Docker Release / Build and publish api (push) Blocked by required conditions
Docker Release / Build and publish web (push) Blocked by required conditions
Docker Release / Build and publish dovecot (push) Blocked by required conditions
Docker Release / Build and publish postfix (push) Blocked by required conditions
Docker Release / Build and publish rspamd (push) Blocked by required conditions
Docker Release / Create GitHub release (push) Blocked by required conditions

fix: delete label without mailboxId caused 404 error on non-default mailbox
This commit is contained in:
LanQin_
2026-06-22 21:11:23 +08:00
committed by GitHub
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ export const api = {
const query = payload.mailboxId ? `?mailboxId=${encodeURIComponent(payload.mailboxId)}` : "" const query = payload.mailboxId ? `?mailboxId=${encodeURIComponent(payload.mailboxId)}` : ""
return request<MailLabel>(`/api/mail/labels${query}`, { method: "POST", body: JSON.stringify({ name: payload.name, color: payload.color || "" }) }) return request<MailLabel>(`/api/mail/labels${query}`, { method: "POST", body: JSON.stringify({ name: payload.name, color: payload.color || "" }) })
}, },
deleteLabel: (id: string) => request<{ labels: MailLabel[] }>(`/api/mail/labels/${id}`, { method: "DELETE" }), deleteLabel: (id: string, mailboxId?: string) => request<{ labels: MailLabel[] }>(`/api/mail/labels/${id}${mailboxId ? `?mailboxId=${encodeURIComponent(mailboxId)}` : ""}`, { method: "DELETE" }),
messages: (folder: string, q = "", cursor = "", mailboxId?: string) => { messages: (folder: string, q = "", cursor = "", mailboxId?: string) => {
const params = new URLSearchParams({ folder, q, cursor }) const params = new URLSearchParams({ folder, q, cursor })
if (mailboxId) params.set("mailboxId", mailboxId) if (mailboxId) params.set("mailboxId", mailboxId)
+1 -1
View File
@@ -236,7 +236,7 @@ export function MailPage() {
onSettled: () => qc.invalidateQueries({ queryKey: ["labels"] }), onSettled: () => qc.invalidateQueries({ queryKey: ["labels"] }),
}) })
const deleteLabel = useMutation({ const deleteLabel = useMutation({
mutationFn: (id: string) => api.deleteLabel(id), mutationFn: (id: string) => api.deleteLabel(id, activeMailboxId),
onMutate: async (id) => { onMutate: async (id) => {
await qc.cancelQueries({ queryKey: ["labels"] }) await qc.cancelQueries({ queryKey: ["labels"] })
await qc.cancelQueries({ queryKey: ["messages"] }) await qc.cancelQueries({ queryKey: ["messages"] })