Fix chat history with duplicate timestamps
It's possible for 2+ messages to happen with the same timestamp. So after timestamp sorting, sort in the descending order of id so that the message order is kept intact.
This was uncovered when writing tests.
Edited by Mohammed Sadiq