Skip to content

Commit b29713e

Browse files
committed
Fix issue/pr url for non-enhanced notifications
1 parent ab436b5 commit b29713e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

packages/components/src/components/cards/NotificationCard.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,12 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
147147
comments: undefined,
148148
created_at: undefined,
149149
labels: [] as GitHubLabel[],
150-
number: undefined,
150+
number: getIssueOrPullRequestNumberFromUrl(
151+
subject.url || subject.latest_comment_url,
152+
),
151153
state: undefined,
152154
title: subject.title,
153-
url: subject.latest_comment_url || subject.url,
155+
url: subject.url || subject.latest_comment_url,
154156
html_url: '',
155157
user: { avatar_url: '', login: '', html_url: '' },
156158
}) ||
@@ -165,10 +167,12 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
165167
comments: undefined,
166168
labels: [] as GitHubLabel[],
167169
draft: false,
168-
number: undefined,
170+
number: getIssueOrPullRequestNumberFromUrl(
171+
subject.url || subject.latest_comment_url,
172+
),
169173
state: undefined,
170174
title: subject.title,
171-
url: subject.latest_comment_url || subject.url,
175+
url: subject.url || subject.latest_comment_url,
172176
html_url: '',
173177
user: { avatar_url: '', login: '', html_url: '' },
174178
}) ||
@@ -183,7 +187,7 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
183187
created_at: undefined,
184188
name: subject.title,
185189
tag_name: '',
186-
url: subject.latest_comment_url || subject.url,
190+
url: subject.url || subject.latest_comment_url,
187191
}) ||
188192
null
189193

@@ -201,7 +205,9 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
201205

202206
const issueOrPullRequestNumber = issueOrPullRequest
203207
? issueOrPullRequest.number ||
204-
getIssueOrPullRequestNumberFromUrl(issueOrPullRequest!.url)
208+
getIssueOrPullRequestNumberFromUrl(
209+
issueOrPullRequest.html_url || issueOrPullRequest.url,
210+
)
205211
: undefined
206212

207213
const repoAvatarDetails = {

0 commit comments

Comments
 (0)