[lib] Pad message ids with 0 to ensure that sorting is correct
Summary: I took an approach in which we determine the length of the longest id for both local and server ids and then prepend 0 to make all the ids the same length.
Test Plan:
To check if the bug was really there, I modified thread responder to successfuly create a thread only every 12 tries. Then, on web, I opened a pending sidebar, sent 11 messages and then another one and noticed that the message with id local2 was displayed after local10. I performed the same steps after the bugfix (ensuring that nextLocalID in the store is set to 0) and verified that the issue no longer occurs.
Additionally, added some debug statements to verify if all the values are computed and transformed correctly.
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1120