From 61e6e1bf82b277e1035343c60a68fa6729861318 Mon Sep 17 00:00:00 2001 From: Yann Gouffon Date: Thu, 18 Mar 2021 17:08:48 +0100 Subject: [PATCH 1/3] hotfix: give discussion items a link to the repo's discussions until Github push a fix --- src/components/NotificationRow.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index 12d955dc4..3c0f659d4 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -35,6 +35,16 @@ export const NotificationRow: React.FC = ({ const url = generateGitHubWebUrl(notification.subject.url); shell.openExternal(url); } + + // TODO remove this future-legacy code when Github have pushed a fix (see #424) + if ( + notification.subject.url === null + && notification.subject.type === 'Discussion' + && notification.repository.url + ) { + const url = generateGitHubWebUrl(`${notification.repository.url}/discussions`); + shell.openExternal(url); + } }, [notification]); const unsubscribe = (event: React.MouseEvent) => { From 7e18126b38e633226cbcb5c0c93e1170dcfcf8db Mon Sep 17 00:00:00 2001 From: Yann Gouffon Date: Thu, 18 Mar 2021 17:18:46 +0100 Subject: [PATCH 2/3] fix: Prettier in NotificationRow --- src/components/NotificationRow.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index 3c0f659d4..2debc8f7d 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -38,11 +38,13 @@ export const NotificationRow: React.FC = ({ // TODO remove this future-legacy code when Github have pushed a fix (see #424) if ( - notification.subject.url === null - && notification.subject.type === 'Discussion' - && notification.repository.url + notification.subject.url === null && + notification.subject.type === 'Discussion' && + notification.repository.url ) { - const url = generateGitHubWebUrl(`${notification.repository.url}/discussions`); + const url = generateGitHubWebUrl( + `${notification.repository.url}/discussions` + ); shell.openExternal(url); } }, [notification]); From 97b80c13fe4e94418d482f925ec14ffc2de3a47c Mon Sep 17 00:00:00 2001 From: Yann Gouffon Date: Mon, 29 Nov 2021 17:29:13 +0100 Subject: [PATCH 3/3] fix: adapt and clean according to generateGitHubWebUrl updates --- src/components/NotificationRow.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index 3426f678d..123b66152 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -38,16 +38,12 @@ export const NotificationRow: React.FC = ({ accounts.user?.id ); shell.openExternal(url); - } - - // TODO remove this future-legacy code when Github have pushed a fix (see #424) - if ( - notification.subject.url === null && - notification.subject.type === 'Discussion' && - notification.repository.url - ) { + // For discussions, we can at least send users to the main discussions page. + } else if (notification.subject.type === 'Discussion') { const url = generateGitHubWebUrl( - `${notification.repository.url}/discussions` + `${notification.repository.url}/discussions`, + notification.id, + accounts.user?.id ); shell.openExternal(url); }