Fix message ordering

This commit is contained in:
Jonathan Staab 2023-04-12 13:30:21 -05:00
parent d63d8afbbf
commit c1857dea2d
2 changed files with 4 additions and 6 deletions

View File

@ -3,7 +3,6 @@
- [ ] Refactor
- Move global modals to child components?
- Combine app/agent, rename app2
- Sort DMs
- [ ] Improve topic suggestions and rendering
- [ ] Add topic search
- [ ] Relays bounty

View File

@ -9,7 +9,8 @@
let activeTab = "messages"
let contacts = []
const getContacts = tab => sortBy(c => -c.lastMessage, tab === "messages" ? $accepted : $requests)
const getContacts = tab =>
sortBy(c => -c.lastMessage || 0, tab === "messages" ? $accepted : $requests)
$: contacts = getContacts(activeTab)
@ -17,10 +18,8 @@
activeTab = tab
}
const accepted = watch("contacts", t => sortBy(e => -e.lastMessage, t.all({accepted: true})))
const requests = watch("contacts", t =>
sortBy(e => -e.lastMessage, t.all({accepted: {$ne: true}}))
)
const accepted = watch("contacts", t => t.all({accepted: true}))
const requests = watch("contacts", t => t.all({accepted: {$ne: true}}))
const getDisplay = tab => ({
title: toTitle(tab),