MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / processNewThread

Function processNewThread

packages/integration-linear/src/outbound.ts:77–120  ·  view source on GitHub ↗
({
  threadId,
  integration,
}: {
  threadId: string;
  integration: channelsIntegration;
})

Source from the content-addressed store, hash-verified

75}
76
77async function processNewThread({
78 threadId,
79 integration,
80}: {
81 threadId: string;
82 integration: channelsIntegration;
83}) {
84 const thread = await linenSdk.getThread({
85 channelId: integration.channelId,
86 threadId,
87 });
88
89 if (!thread) {
90 return 'ThreadNotFound';
91 }
92
93 if (!thread.messages.length) {
94 return 'ThreadNotFound';
95 }
96
97 if (thread.externalThreadId) {
98 return 'skip two-way sync due thread is not from linen';
99 }
100
101 // create issue
102 const newThread = await createThread({
103 accessToken: integration.data.access_token,
104 description: thread.messages[0].body,
105 createAsUser: thread.messages[0].author?.displayName || 'linen-user',
106 displayIconUrl: thread.messages[0].author?.profileImageUrl || undefined,
107 title: thread.messages[0].body,
108 teamId: integration.externalId,
109 });
110
111 if (newThread?.id) {
112 await linenSdk.updateThread({
113 externalThreadId: newThread.id,
114 threadId,
115 channelId: integration.channelId,
116 });
117 }
118
119 return `issue created`;
120}
121
122async function processThreadUpdate({
123 threadId,

Callers

nothing calls this directly

Calls 3

createThreadFunction · 0.90
getThreadMethod · 0.80
updateThreadMethod · 0.65

Tested by

no test coverage detected