From 898a6180e0fe529a54f42e4610a4738a6b1ccb44 Mon Sep 17 00:00:00 2001 From: zugdev Date: Sun, 8 Dec 2024 13:08:54 -0300 Subject: [PATCH] feat: proper redirect URL --- src/home/rendering/render-github-issues.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/home/rendering/render-github-issues.ts b/src/home/rendering/render-github-issues.ts index 1ebf05d..0568da8 100644 --- a/src/home/rendering/render-github-issues.ts +++ b/src/home/rendering/render-github-issues.ts @@ -62,7 +62,13 @@ function everyNewNotification({ notification, notificationsContainer }: { notifi const labels = parseAndGenerateLabels(notification); const [organizationName, repositoryName] = notification.notification.repository.url.split("/").slice(-2); - setUpIssueElement(issueElement, notification, organizationName, repositoryName, labels, notification.notification.subject.url); + let url; + if(notification.notification.subject.type === "Issue"){ + url = notification.issue.html_url; + } else if(notification.notification.subject.type === "PullRequest"){ + url = notification.pullRequest?.html_url; + } + setUpIssueElement(issueElement, notification, organizationName, repositoryName, labels, url as string); issueWrapper.appendChild(issueElement); notificationsContainer.appendChild(issueWrapper); @@ -100,12 +106,8 @@ function setUpIssueElement( issueWrapper.classList.add("selected"); - const full = notification; - if (!full) { - window.open(url, "_blank"); - } else { - //previewIssue(notification); - } + window.open(url, "_blank"); + } catch (error) { return renderErrorInModal(error as Error); }