Page MenuHomePhabricator

[lib] Extract the unsupported sidebar source message types to one single source of truth
ClosedPublic

Authored by rohan on Sep 19 2023, 11:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 3, 10:42 PM
Unknown Object (File)
Sat, Oct 19, 4:49 AM
Unknown Object (File)
Sat, Oct 19, 4:49 AM
Unknown Object (File)
Sat, Oct 19, 4:49 AM
Unknown Object (File)
Sat, Oct 19, 4:48 AM
Unknown Object (File)
Oct 12 2024, 8:04 AM
Unknown Object (File)
Oct 1 2024, 8:10 PM
Unknown Object (File)
Sep 19 2024, 7:48 PM
Subscribers

Details

Summary

As mentioned in the previous diff, we want a single source of truth for a list of message types that should disallow sidebar creation. This diff moves the check into a helper function in
message-utils.js, and adds a quick unit test alongside this to check the integrity of the method.

Depends on D9237

Addresses part of ENG-4849

Test Plan

Ran flow, confirmed that the test plan in D9237 still works, and ran yarn workspace lib test to see the unit tests passing

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

keyserver/src/creators/thread-creator.js
422–429

I'm actually not certain on if this is the right invariant, it seems to be doing exactly what the helper method does and may be redundant. I'm going to take another look at this tomorrow

Accepting to unblock; we can dedup everything and figure out the types later. This Linear comment will hopefully be helpful

keyserver/src/creators/thread-creator.js
422–429

I think you only need to invariant on messageTypes.SIDEBAR_SOURCE right now, but that's because this type only excludes SIDEBAR_SOURCE, when arguably it should exclude all of them

Making sure that the lists match up can be handled later. Leaving this invariant here is probably fine, but it would be good to update the types as well

lib/shared/message-utils.js
645

Same comment as here... feels like we can use isMessageSidebarSourceReactionEditOrPin

lib/shared/message-utils.test.js
7

Love the tests!

This revision is now accepted and ready to land.Sep 20 2023, 6:01 AM

As discussed, landing as is and will address feedback / de-duping while working on the major changes