Merge pull request #137 from 13x-tech/fix/note-to-self-sort

sort bug in the event that your pubkey is the 2nd item in the list
This commit is contained in:
Kieran 2023-01-25 18:07:40 +00:00 committed by GitHub
commit a8414d2b0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -57,8 +57,9 @@ export default function MessagesPage() {
<div className="btn" onClick={() => markAllRead()}>Mark All Read</div>
</div>
{chats.sort((a, b) => {
if(b.pubkey === myPubKey) return 1
return b.newestMessage - a.newestMessage
return a.pubkey === myPubKey ? -1 :
b.pubkey === myPubKey ? 1 :
b.newestMessage - a.newestMessage
}).map(person)}
</>
)