Page MenuHomePhabricator

[keyserver/lib] Restrict the derivedMessages parameter from being passed to rawMessageInfoFromServerDBRow
ClosedPublic

Authored by rohan on Oct 19 2023, 10:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 3:54 PM
Unknown Object (File)
Mon, Nov 4, 7:33 PM
Unknown Object (File)
Sat, Oct 19, 4:19 AM
Unknown Object (File)
Sat, Oct 19, 4:19 AM
Unknown Object (File)
Sat, Oct 19, 4:19 AM
Unknown Object (File)
Sat, Oct 19, 4:18 AM
Unknown Object (File)
Sat, Oct 19, 4:02 AM
Unknown Object (File)
Oct 9 2024, 9:43 AM
Subscribers

Details

Summary

This should hopefully be the last step of ENG-4849. Now that we have a function parseDerivedMessages defined only in the message specs that will need to support derived messages (SIDEBAR_SOURCE and TOGGLE_PIN), we want to update the callsites of rawMessageInfoFromServerDBRow in message-fetchers to only pass in derivedMessages if necessary. This means for rawMessageInfoFromServerDBRow to receive derivedMessages, the message spec must have a parseDerivedMessages function in it.

Regarding the callsites, although we definitely don't need to pass in derivedMessages for the multimedia spec (I checked that it's not destructred), just to have it resistant to change I've only excluded it if parseDerivedMessages is not defined. For all other message specs, the same logic applies as well.

Resolves https://linear.app/comm/issue/ENG-5320/restrict-the-derivedmessages-parameter-from-being-passed-to

Depends on D9542

Test Plan

Ran flow and manually tested the web app to confirm that there are no regressions with this change

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lib/shared/messages/toggle-pin-message-spec.js
52 ↗(On Diff #32221)

Same invariant as sidebar-source-message-spec

keyserver/src/fetchers/message-fetchers.js
249 ↗(On Diff #32221)

Won't this always be true? If it's not specified it will be undefined, and undefined !== null so this would be true

keyserver/src/fetchers/message-fetchers.js
249 ↗(On Diff #32221)

Yeah you're right, oversight on my part

Check undefined instead of null. Confirmed that previously requiresDerivedMessages was always true regardless of the type, but now it's only true for TOGGLE_PIN and SIDEBAR_SOURCE

This revision is now accepted and ready to land.Oct 20 2023, 12:07 PM