HomePhabricator
Diffusion Comm f35b36a68e58

[lib] Fix `rawMessageInfoFromClientDB` to exclude `id` from local text messages

Description

[lib] Fix rawMessageInfoFromClientDB to exclude id from local text messages

Summary:

  1. We currently use id as the primary key of the SQLite messages table
  2. We use the message-utils:messageID function to determine the id we include in the ClientDBMessageInfo. So if we have a message with only a local ID, both the id and local_id will be set to it.
  3. However, when we try to pull the rawMessageInfo back out of SQLite, we have an extraneous id property that shouldn't have been included.
  4. In order to leave out the extraneous id property so the object we end up with is identical to the object we started off with: we exclude the id property unless it's different than the local_id.
  5. After these changes we end with the same rawMessageInfo we started off with.

Added a test that previously failed and now passes to ensure the correct behavior. Will make this change for the other ComposableMessageTypes (aka images)

Test Plan: Our SQLite store and Redux store are no longer different after the SEND_TEXT_MESSAGE_STARTED action

Reviewers: def-au1t, palys-swm, ashoat

Reviewed By: palys-swm, ashoat

Subscribers: ashoat, Adrian, karol-bisztyga, benschac, boristopalov

Differential Revision: https://phabricator.ashoat.com/D2601

Details

Provenance
atulAuthored on Dec 9 2021, 4:19 PM
Reviewer
tomek
Differential Revision
Restricted Differential Revision
Parents
rCOMM896eef9a70e9: [lib] Introduce migration that inserts `messageStore.messages` into the Client…
Branches
Unknown
Tags
Unknown