update list of emails from/to preview

This commit is contained in:
2026-08-30 08:54:10 +01:00
parent 77f4b04af6
commit 69d82f1c96
4 changed files with 50 additions and 29 deletions
+2
View File
@@ -279,6 +279,8 @@ body.app-page{overflow:hidden}
.msg-thread-count{color:var(--muted);font-size:11px;font-weight:600}
.msg-preview{color:var(--muted)}
.msg-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}
.msg-account-name{font-size:10px;color:var(--muted);flex-shrink:0;max-width:110px;overflow:hidden;
text-overflow:ellipsis;white-space:nowrap;background:var(--surface3);padding:1px 6px;border-radius:4px}
.msg-icons{display:flex;align-items:center;gap:4px;flex-shrink:0}
.msg-size{font-size:10px;color:var(--muted)}
.msg-star{color:var(--muted);font-size:15px;cursor:pointer}
+18 -3
View File
@@ -1349,7 +1349,14 @@ function renderMessageList() {
// Update bulk action bar
updateBulkBar();
list.innerHTML=msgs.map((m,i)=>`
const sentView = isSentFolderView();
list.innerHTML=msgs.map((m,i)=>{
const acctLabel = m.account_name || m.account_email || '';
const fromLine = sentView
? `To: ${m.to_list || '(no recipient)'}`
: (m.from_name ? `${m.from_name} - ${m.from_email}` : (m.from_email||''));
return `
<div class="message-item ${m.id===S.selectedMessageId&&!SEL.ids.size?'active':''} ${!m.is_read?'unread':''} ${SEL.ids.has(m.id)?'selected':''}"
data-id="${m.id}" data-idx="${i}"
draggable="true"
@@ -1359,7 +1366,8 @@ function renderMessageList() {
<div class="msg-top">
<span class="msg-unread-dot" title="${m.is_read?'':'Unread'}"></span>
<span class="msg-dot" style="background:${m.account_color}" title="${esc(m.account_email||'')}"></span>
<span class="msg-from">${esc(m.from_name||m.from_email)}</span>
<span class="msg-account-name" title="${esc(m.account_email||'')}">${esc(acctLabel)}</span>
<span class="msg-from" title="${esc(fromLine)}">${esc(fromLine)}</span>
<span class="msg-date">${formatDate(m.date)}</span>
</div>
<div class="msg-line2">
@@ -1373,7 +1381,8 @@ function renderMessageList() {
<span class="msg-star ${m.is_starred?'on':''}" onclick="toggleStar(${m.id},event)">${m.is_starred?'★':'☆'}</span>
</span>
</div>
</div>`).join('')+(S.messages.length<S.totalMessages
</div>`;
}).join('')+(S.messages.length<S.totalMessages
?`<div class="load-more"><button class="load-more-btn" onclick="loadMoreMessages()">Load more</button></div>`:'');
// Enable drag-drop onto folder nav items
@@ -1509,6 +1518,12 @@ async function openMessage(id) {
function isDraftFolder(folderId) {
return S.folders?.find(f=>f.id===folderId)?.folder_type==='drafts';
}
// Whether the currently open folder is a Sent folder — used by renderMessageList to show
// "To: <recipient>" instead of the from-line, since a Sent row's "from" is always just your
// own account and tells you nothing about who the message actually went to.
function isSentFolderView() {
return S.folders?.find(f=>f.id===S.currentFolder)?.folder_type==='sent';
}
function resumeDraft(msg) {
const toList=(msg.to||'').split(',').map(s=>s.trim()).filter(Boolean);
const ccList=(msg.cc||'').split(',').map(s=>s.trim()).filter(Boolean);