Browse Source

Fix DM sorting bug

Changelog-Fixed: Fix DM sorting on incoming messages
translations_damus-localizations-en-us-xcloc-localized-contents-en-us-xliff--master_es_419
William Casarin 2 years ago
parent
commit
a71c35a6b0
  1. 5
      damus/Models/HomeModel.swift

5
damus/Models/HomeModel.swift

@ -648,12 +648,9 @@ 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 {
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
}
return false
}
}
return new_events

Loading…
Cancel
Save