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. 7
      damus/Models/HomeModel.swift

7
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
}
}

Loading…
Cancel
Save