MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / eventNewThread

Function eventNewThread

apps/web/services/events/eventNewThread.ts:31–114  ·  view source on GitHub ↗
({
  channelId,
  messageId,
  threadId,
  imitationId,
  mentions = [],
  mentionNodes = [],
  communityId,
  thread,
  userId,
  isLinenMessage,
}: NewThreadEvent)

Source from the content-addressed store, hash-verified

29};
30
31export 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) {

Callers 2

createMethod · 0.90
addMessageFunction · 0.90

Calls 12

eventNewMentionsFunction · 0.90
resolvePushFunction · 0.90
createNotificationJobFunction · 0.90
createTwoWaySyncJobFunction · 0.90
matrixNewThreadFunction · 0.90
findOrCreateLinenBotFunction · 0.90
createLlmQuestionTaskFunction · 0.90
unarchiveChannelMethod · 0.80
getAccountByThreadIdMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected