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 - [ ] Refactor
- Move global modals to child components? - Move global modals to child components?
- Combine app/agent, rename app2 - Combine app/agent, rename app2
- Sort DMs
- [ ] Improve topic suggestions and rendering - [ ] Improve topic suggestions and rendering
- [ ] Add topic search - [ ] Add topic search
- [ ] Relays bounty - [ ] Relays bounty

View File

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