Skip to content

Commit

Permalink
Merge pull request #848 from The-Commit-Company/fix-dm-sorting-on-mobile
Browse files Browse the repository at this point in the history
fix: DM sorting by last message on mobile
  • Loading branch information
nikkothari22 authored Apr 10, 2024
2 parents c5f0da8 + 0d99e05 commit 35aecdd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions mobile/src/pages/direct-messages/DirectMessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,9 @@ const useMessageUsersList = () => {
})

return usersWithChannels.sort((a, b) => {
if (a.channel && b.channel) {
const bTimestamp = b.channel.last_message_timestamp ? new Date(b.channel.last_message_timestamp).getTime() : 0
const aTimestamp = a.channel.last_message_timestamp ? new Date(a.channel.last_message_timestamp).getTime() : 0
return new Date(bTimestamp).getTime() - new Date(aTimestamp).getTime()
}
return 0
const bTimestamp = b.channel?.last_message_timestamp ? new Date(b.channel.last_message_timestamp).getTime() : 0
const aTimestamp = a.channel?.last_message_timestamp ? new Date(a.channel.last_message_timestamp).getTime() : 0
return bTimestamp - aTimestamp
})
}, [users, dm_channels])

Expand Down

0 comments on commit 35aecdd

Please sign in to comment.