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

Function processNewMessage

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

Source from the content-addressed store, hash-verified

31}
32
33async function processNewMessage({
34 messageId,
35 integration,
36}: {
37 messageId: string;
38 integration: channelsIntegration;
39}) {
40 const message = await linenSdk.getMessage({
41 messageId,
42 });
43
44 if (!message) {
45 return 'MessageNotFound';
46 }
47
48 if (!message.threadId) {
49 return 'ThreadNotFound';
50 }
51
52 const thread = await linenSdk.getThread({
53 channelId: message.channelId,
54 threadId: message.threadId,
55 });
56
57 if (!thread || !thread.externalThreadId) {
58 return 'thread not found';
59 }
60
61 if (message.externalMessageId) {
62 return 'skip two-way sync due message is not from linen';
63 }
64
65 // create comment
66 await createMessage({
67 accessToken: integration.data.access_token,
68 body: message.body,
69 createAsUser: message.author?.displayName || 'linen-user',
70 issueId: thread.externalThreadId,
71 displayIconUrl: message.author?.profileImageUrl || undefined,
72 });
73
74 return `issue commented`;
75}
76
77async function processNewThread({
78 threadId,

Callers

nothing calls this directly

Calls 3

createMessageFunction · 0.90
getMessageMethod · 0.80
getThreadMethod · 0.80

Tested by

no test coverage detected