MCPcopy Create free account
hub / github.com/CommE2E/comm / filterOutThreadAndDescendantIDs

Function filterOutThreadAndDescendantIDs

native/utils/drawer-utils.react.js:102–116  ·  view source on GitHub ↗
(
  idsToFilter: $ReadOnlyArray<string>,
  allItems: $ReadOnlyArray<CommunityDrawerItemData<T>>,
  threadID: string,
)

Source from the content-addressed store, hash-verified

100}
101
102function filterOutThreadAndDescendantIDs<T>(
103 idsToFilter: $ReadOnlyArray<string>,
104 allItems: $ReadOnlyArray<CommunityDrawerItemData<T>>,
105 threadID: string,
106): $ReadOnlyArray<string> {
107 const childItems = findThreadChildrenItems(allItems, threadID);
108 if (!childItems) {
109 return [];
110 }
111 const descendants = findAllDescendantIDs(childItems);
112 const descendantsSet = new Set(descendants);
113 return idsToFilter.filter(
114 item => !descendantsSet.has(item) && item !== threadID,
115 );
116}
117
118export { flattenDrawerItemsData, filterOutThreadAndDescendantIDs };

Callers 1

CommunityDrawerContentFunction · 0.90

Calls 3

findThreadChildrenItemsFunction · 0.85
findAllDescendantIDsFunction · 0.85
hasMethod · 0.65

Tested by

no test coverage detected