( pendingThreadID: string, )
| 421 | }; |
| 422 | |
| 423 | function parsePendingThreadID( |
| 424 | pendingThreadID: string, |
| 425 | ): ?PendingThreadIDContents { |
| 426 | const pendingRegex = new RegExp(`^${pendingThreadIDRegex}$`); |
| 427 | const pendingThreadIDMatches = pendingRegex.exec(pendingThreadID); |
| 428 | if (!pendingThreadIDMatches) { |
| 429 | return null; |
| 430 | } |
| 431 | |
| 432 | const [threadTypeString, threadKey] = pendingThreadIDMatches[1].split('/'); |
| 433 | const protocolString = |
| 434 | pendingThreadIDMatches[pendingThreadIDMatches.length - 1]; |
| 435 | |
| 436 | const threadType = |
| 437 | protocols().find( |
| 438 | p => p.sidebarConfig?.pendingSidebarURLPrefix === threadTypeString, |
| 439 | )?.sidebarConfig?.sidebarThreadType ?? |
| 440 | assertThreadType(Number(threadTypeString.replace('type', ''))); |
| 441 | |
| 442 | let protocol = null; |
| 443 | if (protocolString && protocolString.startsWith('/protocol_')) { |
| 444 | protocol = protocolString.replace('/protocol_', ''); |
| 445 | } |
| 446 | |
| 447 | const threadTypeStringIsSidebar = threadTypeIsSidebar(threadType); |
| 448 | const memberIDs = threadTypeStringIsSidebar ? [] : threadKey.split('+'); |
| 449 | const sourceMessageID = threadTypeStringIsSidebar ? threadKey : null; |
| 450 | return { |
| 451 | threadType, |
| 452 | memberIDs, |
| 453 | sourceMessageID, |
| 454 | protocol, |
| 455 | }; |
| 456 | } |
| 457 | |
| 458 | type BasicUserInfo = { |
| 459 | +id: string, |
no test coverage detected