damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit a71c35a6b05996d83712ebc0d7e0696a69dda96f
parent d69d3cc74e415a73b2e3f913997b70e9149ba0d7
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 14 Jan 2023 17:21:44 -0800

Fix DM sorting bug

Changelog-Fixed: Fix DM sorting on incoming messages

Diffstat:
Mdamus/Models/HomeModel.swift | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/damus/Models/HomeModel.swift b/damus/Models/HomeModel.swift @@ -648,11 +648,8 @@ func handle_incoming_dm(prev_events: NewEventsBits, dms: DirectMessagesModel, ou if inserted { new_events = handle_last_events(new_events: prev_events, ev: ev, timeline: .dms, shouldNotify: !ours) - dms.dms = dms.dms.sorted { a, b in - if a.1.events.count > 0 && b.1.events.count > 0 { - return a.1.events.last!.created_at > b.1.events.last!.created_at - } - return false + dms.dms = dms.dms.filter({ $0.1.events.count > 0 }).sorted { a, b in + return a.1.events.last!.created_at > b.1.events.last!.created_at } }