Page MenuHomePhabricator

[lib] Add conversions for draft store
ClosedPublic

Authored by michal on Jun 30 2023, 2:40 AM.
Tags
None
Referenced Files
F3501874: D8382.id28405.diff
Fri, Dec 20, 3:51 AM
F3501518: D8382.id28656.diff
Fri, Dec 20, 3:42 AM
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
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
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil added inline comments.
lib/utils/migration-utils.js
15 ↗(On Diff #28283)

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

23 ↗(On Diff #28283)

can be simplified

26–33 ↗(On Diff #28283)

I think an early exit will make this more readable

47–58 ↗(On Diff #28283)

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.