({
channelId,
messageId,
threadId,
imitationId,
mentions = [],
mentionNodes = [],
communityId,
thread,
userId,
isLinenMessage,
}: NewThreadEvent)
| 29 | }; |
| 30 | |
| 31 | export async function eventNewThread({ |
| 32 | channelId, |
| 33 | messageId, |
| 34 | threadId, |
| 35 | imitationId, |
| 36 | mentions = [], |
| 37 | mentionNodes = [], |
| 38 | communityId, |
| 39 | thread, |
| 40 | userId, |
| 41 | isLinenMessage, |
| 42 | }: NewThreadEvent) { |
| 43 | const event = { |
| 44 | channelId, |
| 45 | messageId, |
| 46 | threadId, |
| 47 | imitationId, |
| 48 | isThread: true, |
| 49 | isReply: false, |
| 50 | thread, |
| 51 | }; |
| 52 | |
| 53 | const channel = await ChannelsService.getChannelAndMembersWithAuth(channelId); |
| 54 | |
| 55 | const promises: Promise<any>[] = [ |
| 56 | eventNewMentions({ |
| 57 | mentions, |
| 58 | mentionNodes, |
| 59 | channelId, |
| 60 | threadId, |
| 61 | authorId: userId, |
| 62 | }), |
| 63 | ...resolvePush({ channel, userId, event, communityId }), |
| 64 | ]; |
| 65 | |
| 66 | if (isLinenMessage) { |
| 67 | promises.push( |
| 68 | ...[ |
| 69 | createNotificationJob(messageId, { |
| 70 | ...event, |
| 71 | communityId, |
| 72 | mentions, |
| 73 | mentionNodes, |
| 74 | }), |
| 75 | createTwoWaySyncJob({ ...event, event: 'newThread', id: messageId }), |
| 76 | matrixNewThread(event), |
| 77 | ] |
| 78 | ); |
| 79 | if (channel?.type === ChannelType.DM) { |
| 80 | promises.push( |
| 81 | ChannelsService.unarchiveChannel({ channelId: channel.id }) |
| 82 | ); |
| 83 | } |
| 84 | |
| 85 | const llm = channel?.channelsIntegration.find( |
| 86 | (ci) => ci.type === channelsIntegrationType.LLM |
| 87 | ); |
| 88 | if (channel?.accountId && llm?.data) { |
no test coverage detected