From 5c2f206c74b7f8d5d890d0e680d8f996efe2640a Mon Sep 17 00:00:00 2001 From: Shuki Vaknin Date: Wed, 24 Jun 2026 05:48:29 +0300 Subject: [PATCH] feat(mail): return to the list after marking an open message unread Gmail-style: marking the currently-open message unread returns to the message list instead of staying in the reading pane (where the viewer's auto-mark-read would just flip it back to read). Gated on the returnToListAfterAction setting added in #477 (default on); when off, you stay in the viewer. Only the single-message viewer, and only on mark-unread (read === false). --- app/(main)/[locale]/page.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/(main)/[locale]/page.tsx b/app/(main)/[locale]/page.tsx index c07514fe..2f64a114 100644 --- a/app/(main)/[locale]/page.tsx +++ b/app/(main)/[locale]/page.tsx @@ -3118,6 +3118,12 @@ export default function Home() { onMarkAsRead={async (emailId, read) => { if (client) { await markAsRead(client, emailId, read); + // Marking the open message unread returns to the list + // (Gmail-style, gated on returnToListAfterAction). Staying + // in the reading pane would just re-mark it read on view. + if (!read && useSettingsStore.getState().returnToListAfterAction) { + handleMobileBack(); + } } }} onDownloadAttachment={handleDownloadAttachment}