From e30783bfaaa9e40815493d28b49ba7c41ac86414 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:19:47 +0800 Subject: [PATCH] fix: only use discussion for feed error --- apps/renderer/src/lib/issues.ts | 16 +++++++++++++--- apps/renderer/src/modules/discover/feed-form.tsx | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/renderer/src/lib/issues.ts b/apps/renderer/src/lib/issues.ts index e1e8e60663..f049d3ba11 100644 --- a/apps/renderer/src/lib/issues.ts +++ b/apps/renderer/src/lib/issues.ts @@ -6,13 +6,23 @@ interface IssueOptions { body: string label: string error?: Error + target: "issue" | "discussion" + category: string } -export const getNewIssueUrl = ({ body, label, title, error }: Partial = {}) => { - const baseUrl = `${repository.url}/discussions/new` +export const getNewIssueUrl = ({ + body, + label, + title, + error, + target = "issue", + category, +}: Partial = {}) => { + const baseUrl = + target === "discussion" ? `${repository.url}/discussions/new` : `${repository.url}/issues/new` const searchParams = new URLSearchParams() - searchParams.set("category", "feed-expired") + if (category) searchParams.set("category", category) let nextBody = [body || "", "", ...getCurrentEnvironment()].join("\n") if (label) searchParams.set("label", label) diff --git a/apps/renderer/src/modules/discover/feed-form.tsx b/apps/renderer/src/modules/discover/feed-form.tsx index 9a0abec8a4..58c4b09694 100644 --- a/apps/renderer/src/modules/discover/feed-form.tsx +++ b/apps/renderer/src/modules/discover/feed-form.tsx @@ -140,6 +140,8 @@ export const FeedForm: Component<{ "```", ].join("\n"), title: `Error in fetching feed: ${id ?? url}`, + target: "discussion", + category: "feed-expired", }), "_blank", )