From 210150a02e409a7eaf6430ef5fadd4cbf21145b0 Mon Sep 17 00:00:00 2001 From: Vadim Belov <81349914+bvdcode@users.noreply.github.com> Date: Fri, 1 May 2026 10:02:27 -0700 Subject: [PATCH 1/3] Fix push preview JMAP query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve the Inbox mailbox id before running Email/query. The previous query passed a JMAP result reference object directly into the inMailbox filter, which can make the preview endpoint return 502 and cause push notifications to fall back to the generic “New mail” text. --- app/api/push/preview/route.ts | 54 +++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/app/api/push/preview/route.ts b/app/api/push/preview/route.ts index 32c6bb08..2d18b44a 100644 --- a/app/api/push/preview/route.ts +++ b/app/api/push/preview/route.ts @@ -40,17 +40,53 @@ export async function GET(request: NextRequest) { return NextResponse.json({ error: 'Incomplete JMAP session' }, { status: 502 }); } - // Find the inbox, then pull the most recent unread message in it. We use - // a single batched JMAP request with back-references so this round-trip - // is one POST regardless of how many messages exist. + const inboxRes = await fetch(apiUrl, { + method: 'POST', + headers: { + Authorization: creds.authHeader, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'], + methodCalls: [ + [ + 'Mailbox/query', + { accountId, filter: { role: 'inbox' }, limit: 1 }, + 'mb', + ], + ], + }), + }); + + if (!inboxRes.ok) { + return NextResponse.json({ error: 'JMAP mailbox query failed' }, { status: 502 }); + } + + const inboxData = (await inboxRes.json()) as { + methodResponses: [string, Record, string][]; + }; + + const inboxBody = inboxData.methodResponses.find( + ([method]) => method === 'Mailbox/query', + )?.[1] as { ids?: string[] } | undefined; + + const inboxId = inboxBody?.ids?.[0]; + + if (!inboxId) { + return NextResponse.json({ + email: null, + unreadTotal: 0, + }, { + headers: { + 'Cache-Control': 'no-store', + }, + }); + } + + // Pull the most recent unread message from the resolved Inbox mailbox. const requestBody = { using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'], methodCalls: [ - [ - 'Mailbox/query', - { accountId, filter: { role: 'inbox' }, limit: 1 }, - 'mb', - ], [ 'Email/query', { @@ -58,7 +94,7 @@ export async function GET(request: NextRequest) { filter: { operator: 'AND', conditions: [ - { inMailbox: { resultOf: 'mb', name: 'Mailbox/query', path: '/ids/0' } }, + { inMailbox: inboxId }, { notKeyword: '$seen' }, ], }, From 8c74e01a40ae49a76380af958c58a57c50551f8b Mon Sep 17 00:00:00 2001 From: Luis Felipe Marzagao Date: Fri, 1 May 2026 17:47:21 +0000 Subject: [PATCH 2/3] fix: add useTranslations for "selected emails" and "cancel" on email list batch operations --- components/email/email-list.tsx | 4 ++-- locales/en/common.json | 1 + locales/fr/common.json | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/email/email-list.tsx b/components/email/email-list.tsx index 605672ad..dc478e8d 100644 --- a/components/email/email-list.tsx +++ b/components/email/email-list.tsx @@ -275,7 +275,7 @@ export function EmailList({
- {selectedEmailIds.size} {selectedEmailIds.size === 1 ? 'email' : 'emails'} selected + {t('batch_actions.selected_messages', { count: selectedEmailIds.size })}
@@ -330,7 +330,7 @@ export function EmailList({ disabled={isProcessing} className="text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50" > - Cancel + {t('batch_actions.clear_selection')}
diff --git a/locales/en/common.json b/locales/en/common.json index 39cb5af0..071d078f 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Select emails", "select_all": "Select all", + "selected_messages": "{count, plural, one {1 email} other {# emails}} selected", "mark_read": "Mark as read", "mark_unread": "Mark as unread", "delete": "Delete", diff --git a/locales/fr/common.json b/locales/fr/common.json index 8578b50f..0c45aefd 100644 --- a/locales/fr/common.json +++ b/locales/fr/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Sélectionner les e-mails", "select_all": "Tout sélectionner", + "selected_messages": "{count, plural, one {1 e-mail sélectionné} other {# e-mails sélectionnés}}", "mark_read": "Marquer comme lu", "mark_unread": "Marquer comme non lu", "delete": "Supprimer", From b86bc541abf426c6ca17547f80da2932265701a5 Mon Sep 17 00:00:00 2001 From: Luis Felipe Marzagao Date: Fri, 1 May 2026 18:11:04 +0000 Subject: [PATCH 3/3] i18n: add missing keys accross 14 locales --- locales/cs/common.json | 1 + locales/de/common.json | 1 + locales/es/common.json | 1 + locales/it/common.json | 1 + locales/ja/common.json | 1 + locales/ko/common.json | 1 + locales/lv/common.json | 1 + locales/nl/common.json | 1 + locales/pl/common.json | 1 + locales/pt/common.json | 1 + locales/ru/common.json | 1 + locales/tr/common.json | 1 + locales/uk/common.json | 1 + locales/zh/common.json | 1 + 14 files changed, 14 insertions(+) diff --git a/locales/cs/common.json b/locales/cs/common.json index a638136f..97afb893 100644 --- a/locales/cs/common.json +++ b/locales/cs/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Vybrat zprávy", "select_all": "Vybrat vše", + "selected_messages": "{count, plural, one {Vybraný 1 e-mail} other {Vybrané # e-maily}}", "mark_read": "Označit jako přečtené", "mark_unread": "Označit jako nepřečtené", "delete": "Odstranit", diff --git a/locales/de/common.json b/locales/de/common.json index 897ec395..b8d34191 100644 --- a/locales/de/common.json +++ b/locales/de/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "E-Mails auswählen", "select_all": "Alle auswählen", + "selected_messages": "{count, plural, one {1 E-Mail} other {# E-Mails}} ausgewählt", "mark_read": "Als gelesen markieren", "mark_unread": "Als ungelesen markieren", "delete": "Löschen", diff --git a/locales/es/common.json b/locales/es/common.json index 7208d4c6..612b9d3f 100644 --- a/locales/es/common.json +++ b/locales/es/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Seleccionar correos", "select_all": "Seleccionar todo", + "selected_messages": "{count, plural, one {1 correo electrónico seleccionado} other {# correos electrónicos seleccionados}}", "mark_read": "Marcar como leído", "mark_unread": "Marcar como no leído", "delete": "Eliminar", diff --git a/locales/it/common.json b/locales/it/common.json index ee0c273d..76fac4be 100644 --- a/locales/it/common.json +++ b/locales/it/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Seleziona e-mail", "select_all": "Seleziona tutto", + "selected_messages": "{count} email {count, plural, one {selezionata} other {selezionate}}", "mark_read": "Segna come letto", "mark_unread": "Segna come non letto", "delete": "Elimina", diff --git a/locales/ja/common.json b/locales/ja/common.json index 5bcd2395..679f7265 100644 --- a/locales/ja/common.json +++ b/locales/ja/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "メールを選択", "select_all": "すべて選択", + "selected_messages": "{count, plural, one {1} other {#}}通のメールが選択されました", "mark_read": "既読にする", "mark_unread": "未読にする", "delete": "削除", diff --git a/locales/ko/common.json b/locales/ko/common.json index 7e3cff7a..bd37be19 100644 --- a/locales/ko/common.json +++ b/locales/ko/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "메일 선택", "select_all": "모두 선택", + "selected_messages": "이메일 {count, plural, one {1개} other {#건}} 선택됨", "mark_read": "읽은 상태로 표시", "mark_unread": "읽지 않은 상태로 표시", "delete": "삭제", diff --git a/locales/lv/common.json b/locales/lv/common.json index d3b5c770..9fda37d1 100644 --- a/locales/lv/common.json +++ b/locales/lv/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Atlasīt vēstules", "select_all": "Atlasīt visas", + "selected_messages": "{count, plural, one {Izvēlēta 1 e-pasta vēstule} other {Izvēlētas # e-pasta vēstules}}", "mark_read": "Atzīmēt kā izlasītu", "mark_unread": "Atzīmēt kā nelasītu", "delete": "Dzēst", diff --git a/locales/nl/common.json b/locales/nl/common.json index 8b012985..490043d3 100644 --- a/locales/nl/common.json +++ b/locales/nl/common.json @@ -185,6 +185,7 @@ "select": "E-mails selecteren", "select_all": "Alles selecteren", "mark_read": "Markeren als gelezen", + "selected_messages": "{count, plural, one {1 e-mail} other {# e-mails}} geselecteerd", "mark_unread": "Markeren als ongelezen", "delete": "Verwijderen", "delete_confirm_title": "E-mails verwijderen", diff --git a/locales/pl/common.json b/locales/pl/common.json index fb57eabc..2f02e3a8 100644 --- a/locales/pl/common.json +++ b/locales/pl/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Zaznacz wiadomości", "select_all": "Zaznacz wszystkie", + "selected_messages": "Wybrano {count, plural, one {1 wiadomość} other {# wiadomości}} e-mail", "mark_read": "Oznacz jako przeczytane", "mark_unread": "Oznacz jako nieprzeczytane", "delete": "Usuń", diff --git a/locales/pt/common.json b/locales/pt/common.json index 05d72752..b166cbc3 100644 --- a/locales/pt/common.json +++ b/locales/pt/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Selecionar e-mails", "select_all": "Selecionar tudo", + "selected_messages": "{count, plural, one {1 e-mail selecionado} other {# e-mails selecionados}}", "mark_read": "Marcar como lido", "mark_unread": "Marcar como não lido", "delete": "Excluir", diff --git a/locales/ru/common.json b/locales/ru/common.json index 37be56ae..3543400a 100644 --- a/locales/ru/common.json +++ b/locales/ru/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Выбрать письма", "select_all": "Выбрать все", + "selected_messages": "Выбрано {count, plural, one {1 письмо} other {# письма}}", "mark_read": "Отметить прочитанными", "mark_unread": "Отметить непрочитанными", "delete": "Удалить", diff --git a/locales/tr/common.json b/locales/tr/common.json index 045c5945..2c100d7a 100644 --- a/locales/tr/common.json +++ b/locales/tr/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "E-postaları seç", "select_all": "Tümünü seç", + "selected_messages": "{count, plural, one {1 e-posta} other {# e-posta}} seçildi", "mark_read": "Okundu olarak işaretle", "mark_unread": "Okunmadı olarak işaretle", "delete": "Sil", diff --git a/locales/uk/common.json b/locales/uk/common.json index 3702630a..bedb7ce1 100644 --- a/locales/uk/common.json +++ b/locales/uk/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "Виберіть електронні листи", "select_all": "Вибрати все", + "selected_messages": "Вибрано {count, plural, one {1 електронний лист} other {# електронні листи}}", "mark_read": "Позначити як прочитане", "mark_unread": "Позначити як непрочитане", "delete": "Видалити", diff --git a/locales/zh/common.json b/locales/zh/common.json index b6d00b09..41c68a30 100644 --- a/locales/zh/common.json +++ b/locales/zh/common.json @@ -184,6 +184,7 @@ "batch_actions": { "select": "选择邮件", "select_all": "全选", + "selected_messages": "已選取 {count, plural, one {1} other {#}} 封電子郵件", "mark_read": "标记为已读", "mark_unread": "标记为未读", "delete": "删除",