From 0aa8d17d6c5aadaa58e930f80e2bec3d0621fc1f Mon Sep 17 00:00:00 2001 From: pewdiepie-archdaemon Date: Thu, 11 Jun 2026 19:46:45 +0900 Subject: [PATCH] Email: bookmark icon everywhere for favorites; subject matches in suggestions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Star → bookmark banner SVG also in the card title row (em.is_flagged glyph) and the inbox toolbar's _starIcon / _starFilledIcon, so every favorites affordance matches the chats sidebar bookmark. Search dropdown gains a third suggestion kind: - kind: 'email' rows surface emails from the snapshot whose subject or sender name match the typed term (top 4, scored by startsWith vs substring). Render row carries a small envelope glyph + bolded subject + 'from name' on the right. - Picking one closes the dropdown and expands that exact card via _toggleCardPreview, scrolling it into view. --- static/js/emailInbox.js | 4 ++-- static/js/emailLibrary.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/static/js/emailInbox.js b/static/js/emailInbox.js index b07469316..5327a46e7 100644 --- a/static/js/emailInbox.js +++ b/static/js/emailInbox.js @@ -22,8 +22,8 @@ const _replyIcon = ' `${svg}`; const _replySeparator = '---------- Previous message ----------'; diff --git a/static/js/emailLibrary.js b/static/js/emailLibrary.js index 887459252..53134d0c1 100644 --- a/static/js/emailLibrary.js +++ b/static/js/emailLibrary.js @@ -1992,6 +1992,13 @@ function _renderSearchSuggestions(items) { ${esc(s.label)} `; } + if (s.kind === 'email') { + return `
+ + ${esc(s.subject)} + ${s.from_name ? `— ${esc(s.from_name)}` : ''} +
`; + } return `
${esc(s.name || s.email)} ${s.name ? `${esc(s.email)}` : ''} @@ -2019,6 +2026,21 @@ function _acceptSuggestion(s) { const input = document.getElementById('email-lib-search'); if (s.kind === 'filter') { _addSearchPill({ type: 'filter', value: s.value, label: s.label }); + } else if (s.kind === 'email') { + // Clear the draft + dropdown and open the matching card directly. + if (input) input.value = ''; + state._libSearchDraft = ''; + _hideSearchSuggestions(); + _applyPillFilter(); + const grid = document.getElementById('email-lib-grid'); + const card = grid?.querySelector(`.doclib-card[data-uid="${CSS.escape(String(s.uid))}"]`); + const em = (state._libEmails || []).find(x => String(x.uid) === String(s.uid)) + || (_libPreSearchEmails || []).find(x => String(x.uid) === String(s.uid)); + if (card && em) { + card.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); + _toggleCardPreview(card, em); + } + return; } else { _addSearchPill({ type: 'contact', name: s.name, email: s.email }); }