v0.7.8 message list order bug fix

This commit is contained in:
2026-03-11 19:59:58 -04:00
parent 67bea6c2c3
commit 5697e3a59c
5 changed files with 8 additions and 9 deletions

View File

@@ -82,16 +82,15 @@ export default function Sidebar({ groups, activeGroupId, onSelectGroup, notifica
];
const publicFiltered = allGroups.filter(g => g.type === 'public');
const dms = allGroups
.filter(g => g.type === 'private' && !!g.is_direct)
// All private groups (DMs + group chats) sorted together by most recent message
const privateFiltered = allGroups
.filter(g => g.type === 'private')
.sort((a, b) => {
if (!a.last_message_at && !b.last_message_at) return 0;
if (!a.last_message_at) return 1;
if (!b.last_message_at) return -1;
return new Date(b.last_message_at) - new Date(a.last_message_at);
});
const privateNonDM = allGroups.filter(g => g.type === 'private' && !g.is_direct);
const privateFiltered = [...privateNonDM, ...dms];
const getNotifCount = (groupId) => notifications.filter(n => n.groupId === groupId).length;
@@ -176,7 +175,7 @@ export default function Sidebar({ groups, activeGroupId, onSelectGroup, notifica
)}
{privateFiltered.length > 0 && (
<div className="group-section">
<div className="section-label">DIRECT MESSAGES</div>
<div className="section-label">MESSAGES</div>
{privateFiltered.map(g => <GroupItem key={g.id} group={g} />)}
</div>
)}