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

Function getPendingThreadID

lib/shared/thread-utils.js:392–411  ·  view source on GitHub ↗
(
  threadType: ThreadType,
  memberIDs: $ReadOnlyArray<string>,
  sourceMessageID: ?string,
  protocol?: ?ProtocolName,
)

Source from the content-addressed store, hash-verified

390}
391
392function getPendingThreadID(
393 threadType: ThreadType,
394 memberIDs: $ReadOnlyArray<string>,
395 sourceMessageID: ?string,
396 protocol?: ?ProtocolName,
397): string {
398 let pendingThreadKey;
399 if (sourceMessageID) {
400 const config = threadSpecs[threadType].protocol().sidebarConfig;
401 invariant(config, `Thread type ${threadType} doesn't support sidebars`);
402 const prefix = config.pendingSidebarURLPrefix;
403 pendingThreadKey = `${prefix}/${sourceMessageID}`;
404 } else {
405 pendingThreadKey = [...memberIDs].sort().join('+');
406 }
407
408 const pendingThreadTypeString = sourceMessageID ? '' : `type${threadType}/`;
409 const pendingThreadProtocolString = protocol ? `/protocol_${protocol}` : '';
410 return `pending/${pendingThreadTypeString}${pendingThreadKey}${pendingThreadProtocolString}`;
411}
412
413type PendingThreadIDContents = {
414 +threadType: ThreadType,

Callers 7

conversionFunctionFunction · 0.90
convertIDToNewSchemaFunction · 0.90
useUpdateRelationshipsFunction · 0.90
createPendingThreadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected