HomePhabricator
Diffusion Comm ad06bcbd05f1

[keyserver/lib] Introduce a parseDerivedMessages function in the message specs

Description

[keyserver/lib] Introduce a parseDerivedMessages function in the message specs

Summary:
The last step of ENG-4849 is to simplify the derived messages logic in fetchDerivedMessages. Ideally, rather than handling parsing out the JSON object in the function itself, we'll introduce a function in specific message specs (only SIDEBAR_SOURCE and TOGGLE_PIN since those are the ones that are involved here) that, if defined, contains the logic for parsing in itself. This once again moves the source of truth to the message specs. The next diff will involve updating the callsites of rawMessageInfoFromServerDBRow to only pass in derivedMessages as a param if this function is defined in the message spec.

Resolves https://linear.app/comm/issue/ENG-5220/introduce-a-requiresderivedmessages-function-in-the-message-specs

Depends on D9538

Test Plan: Logged out requiredIDs before and after this change when loading Comm and confirmed that the Sets were the same containing the same message IDs

Reviewers: atul, ginsu

Reviewed By: atul

Subscribers: ashoat, tomek, wyilio

Differential Revision: https://phab.comm.dev/D9542