Page MenuHomePhabricator

[lib] Introduce a canBeSidebarSource function in each message spec
ClosedPublic

Authored by rohan on Sep 28 2023, 3:47 PM.
Tags
None
Referenced Files
F3395494: D9325.id31538.diff
Sun, Dec 1, 5:22 AM
Unknown Object (File)
Sat, Nov 30, 11:21 AM
Unknown Object (File)
Fri, Nov 29, 9:35 AM
Unknown Object (File)
Fri, Nov 29, 9:34 AM
Unknown Object (File)
Fri, Nov 29, 9:33 AM
Unknown Object (File)
Fri, Nov 29, 9:29 AM
Unknown Object (File)
Wed, Nov 20, 4:38 PM
Unknown Object (File)
Wed, Nov 20, 4:38 PM
Subscribers

Details

Summary

The last part of unifying the logic and source of truth for determining eligible messages to be sidebar sources is to have a canBeSidebarSource function in each message spec. This diff introduces the constant to each existing message spec, and the next diffs will replace the logic in to isInvalidSidebarSoruce to call the message spec. This ensures that we'll only ever need to update the specific message spec in one place and the ValidRawSidebarSourceMessageInfo type if we ever want to change this.

Depends on D9324

Resolves https://linear.app/comm/issue/ENG-5208/introduce-a-canbesidebarsource-function-in-each-message-spec

Test Plan

Ran flow and updated the unit tests to call canBeSidebarSource. yarn workspace lib test passes all tests

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Update unit tests to test for the new message spec function

rohan requested review of this revision.Sep 28 2023, 4:13 PM

Update describe statement in unit tests

Get rid of redundant logic

looks good! Trusting test plan so skimmed through the test file

This revision is now accepted and ready to land.Sep 29 2023, 12:46 PM

This ensures that we'll only ever need to update the specific message spec in one place if we ever want to change this.

Would we also need to update the ValidRawSidebarSourceMessageInfo type introduced in D9324?

This ensures that we'll only ever need to update the specific message spec in one place if we ever want to change this.

Would we also need to update the ValidRawSidebarSourceMessageInfo type introduced in D9324?

Oh yeah you're right, that too if we were change one of the message specs