[keyserver/lib/native] Store the number of pinned messages in ThreadInfo
Summary:
We want to include pinnedCount inside ThreadInfos in order to avoid having to dynamically fetch this number each time a thread is opened. This diff handles this in two ways:
- We always want to include pinnedCount in ServerThreadInfo - then, based on the code version on native, we'd want to conditionally include it into the downstream ThreadInfo types (where we construct, for example, RawThreadInfo from ServerThreadInfo).
- Introduce a redux persist migration to target newly updated clients. Each step in the migration is commented to indicate its purpose. One case that is already handled but important to note: if an old client and a new client are in a thread together (pre and post message pinning versions), when we update the old client, we need to make sure we don't initialize pinnedCount to 0, but instead derive the pinnedCount based on the thread and existence of TOGGLE_PIN messages because there may be message pins in the thread.
Linear: https://linear.app/comm/issue/ENG-3396/store-the-number-of-pinned-messages-in-threadinfo
Depends on D7202
Test Plan:
- Install native off master
- git checkout pinned_messages
- Go on the web client and pin several messages
- Add the redux-persist migration
- Open the native app
- Run yarn redux-devtools and confirm that threadStore has updated pinnedCount values.
- Check the redux devtools on the web client and confirm that threadStore has the updated pinnedCount values.
- Check that ThreadInfo contains pinnedCount:
Reviewers: atul, ginsu, tomek, ashoat
Reviewed By: atul
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D7211