Page MenuHomePhabricator

[lib] Add conversions for draft store
ClosedPublic

Authored by michal on Jun 30 2023, 2:40 AM.
Tags
None
Referenced Files
F3498537: D8382.diff
Thu, Dec 19, 9:29 PM
Unknown Object (File)
Sun, Dec 15, 10:38 PM
Unknown Object (File)
Sun, Dec 15, 10:38 PM
Unknown Object (File)
Sun, Dec 15, 10:38 PM
Unknown Object (File)
Sun, Dec 15, 10:37 PM
Unknown Object (File)
Sun, Dec 15, 10:22 PM
Unknown Object (File)
Thu, Nov 28, 10:12 PM
Unknown Object (File)
Mon, Nov 25, 2:51 PM
Subscribers

Details

Summary

https://linear.app/comm/issue/ENG-3995/create-functions-for-migrating-the-client-stores
This diff introduces functions for migrating the draft store, both in cases when it is persisted in redux and when it's stored in sqlite

Depends on D8355

Test Plan

Run yarn test, tested with the next diffs if they correctly migrated the draft stores

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

kamil added inline comments.
lib/utils/migration-utils.js
15

I would define message_composer as separate constant in lib and update draftKeyFromThreadID() to use it

23

can be simplified

26–33

I think an early exit will make this more readable

47–58

There is an alternative approach based on MOVE_DRAFT, this will require some changes in this logic and seems more suitable, but removing everything and creating new entries is a frequent pattern in codebase so probably it's okay as it is

This revision is now accepted and ready to land.Jul 3 2023, 3:55 AM

Address review.

Left the draft ops logic the same. We use the remove and create new for everything else in this migration so it should be fine.