Skip to content

Commit f0ad2e1

Browse files
committed
Optimize Linear issue creation
1 parent 3b50962 commit f0ad2e1

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

server/src/methods/createLinearIssue.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ the message is : ${text}.
4949
c. Strictly avoid AI-related terms like "optimize", "leverage", "streamline"
5050
d. Should be sentence case.
5151
e. Make sure you added the core issue (what is the issue) and how this issue was exactly created in title.
52-
eg. Message: Dena please fix open DM chats on notification click, its working randomly for me.
52+
eg. Message: Dena please fix open DM chats on notification click, it's working randomly for me.
5353
Title: Fix open DM on notifications click
5454
Message2: @Mo this message failed to translate. It was a long message from a zh user
5555
Title2: Fix translation failure on long zh messages
@@ -128,14 +128,17 @@ type CreateIssueProps = {
128128
}
129129

130130
const createIssueFunc = async (props: CreateIssueProps): Promise<string | undefined> => {
131-
const team = await getLinearTeams({ userId: props.currentUserId })
132-
const teamIdValue = team?.id
133-
const organization = await getLinearOrg({ userId: props.currentUserId })
134-
const statuses = await getLinearIssueStatuses({ userId: props.currentUserId })
135-
const unstarded = statuses.workflowStates.filter((status: any) => status.type === "unstarted")
136-
137131
try {
138-
let result = await createIssue({
132+
const [team, organization, statuses] = await Promise.all([
133+
getLinearTeams({ userId: props.currentUserId }),
134+
getLinearOrg({ userId: props.currentUserId }),
135+
getLinearIssueStatuses({ userId: props.currentUserId }),
136+
])
137+
138+
const teamIdValue = team?.id
139+
const unstarded = statuses.workflowStates.filter((status: any) => status.type === "unstarted")
140+
141+
const result = await createIssue({
139142
userId: props.currentUserId,
140143
title: props.title,
141144
description: props.description,
@@ -147,9 +150,9 @@ const createIssueFunc = async (props: CreateIssueProps): Promise<string | undefi
147150
statusId: unstarded[0].id,
148151
})
149152

150-
let link = generateIssueLink(result?.identifier ?? "", organization?.urlKey ?? "")
151-
return link
153+
return generateIssueLink(result?.identifier ?? "", organization?.urlKey ?? "")
152154
} catch (error) {
153155
Log.shared.error("Failed to create Linear issue", { error })
156+
return undefined
154157
}
155158
}

0 commit comments

Comments
 (0)