[GitHub] Notifications URL's are for API calls
Extension
https://www.raycast.com/raycast/github
Raycast Version
1.88.4
macOS Version
15.2
Description
URL's generated for opening notifications are API URL's. They look something like https://api.github.com/notifications/threads/14063893845. This works for viewing notifications in the interface, but not for opening in browser. Opening in browser yields:
{
"message": "Requires authentication",
"documentation_url": "https://docs.github.com/rest/activity/notifications#get-a-thread",
"status": "401"
}
Steps To Reproduce
- Open "Notifications" command.
- Try to open notification in browser.
Current Behaviour
Returns 401.
Expected Behaviour
Opens the correct web link in lieu of the API URL.
Important Note
I forgot to add the probably most important bit. This only applies to some repositories or notifications, but I'm unclear on what makes that difference. The link above is a publicly accessible repo and thread.
Thank you for opening this issue!
🔔 @thomaslombart @unnamedd @tonka3000 @khasbilegt @pernielsentikaer @loxygenK @oilbeater @LunaticMuch @aeorge @daquinoaldo @peppy @aeither @marcotf @qeude @nesl247 @xilopaint @antonengelhardt @bangerang @wottpal @LitoMore @d-mitrofanov-v @j3lte @jfkisafk @vlasischar @JavaLangRuntimeException @shyakadavis @sushichan044 you might want to have a look.
💡 Author and Contributors commands
The author and contributors of raycast/github can trigger bot actions by commenting:
@raycastbot close this issueCloses the issue.@raycastbot close as not plannedCloses the issue as not planned.@raycastbot rename this issue to "Awesome new title"Renames the issue.@raycastbot reopen this issueReopens the issue.@raycastbot assign meAssigns yourself to the issue.@raycastbot good first issueAdds the "Good first issue" label to the issue.@raycastbot keep this issue openMake sure the issue won't go stale and will be kept open by the bot.
Thanks for reporting this bug. Would you like to work on it? If yes, here's our guide on extension contributions so that you can open up a pull request. Feel free to contact me here or in the Slack community if you need further help.
@theherk The action marks the notification as read and then opens it in the browser, so probably the former action fails and therefore also the latter. Can you share the type of notification (mentioned, review requested, ...)?
async function openNotification(isUnreadNotification: boolean) {
try {
if (url) {
await open(url);
}
if (isUnreadNotification) {
await octokit.activity.markThreadAsRead({ thread_id: parseInt(notification.id) });
await mutateList();
}
} catch (error) {
await showToast({
style: Toast.Style.Failure,
title: "Failed opening notification",
message: getErrorMessage(error),
});
}
}
It might also be interessting to know if you are authenticating with OAuth or with the GitHub Token in the extension settings:
"CI Activity" notifications open, but "Commented" notifications give the error. The notification I gave above is a "State Changed" notification. I am logged in with oath, but I think I've also provided a token. Maybe not, but I can't tell since the box shows dots either way, I believe. I could add a token, but I suffer this issue in the Github Enterprise extension too, which is likely for the same reason, and that one I've definitely added a token for.
I contribute to several extensions, so maybe I'll try to carve out time for these two as well, but I'm not sure when.
Okay, yeah I just regenerated the token I thought I had used add verified it is added definitely. So I'm logged in with oauth and have given a token with the necessary scopes. Same issue.
This issue has been automatically marked as stale because it did not have any recent activity.
It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊
This issue is still present, though I haven't had the time to address it further. Should probably stay open for posterity.
This issue has been automatically marked as stale because it did not have any recent activity.
It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊
Just verified, issue is still present. When opening a notification in browser, the api link is used.
Is this still an issue?
Is this still an issue?
Yes, it is.
I did a bit of a dive into the code, the problem should be fixed here: https://github.com/raycast/extensions/blob/bd74250085a6e680c43d79a4180695446b3accc7/extensions/github/src/helpers/notifications.ts#L40
- If it has
notification.subject.urlit generates a browser url - If not, it creates a url when
notification.subject.type==="CheckSuite" - If not, it creates a url when
notification.subject.type==="Discussion"
else it returns just notification.url, which is a https://api.github.com url.
So, it either can't find the notification.subject.url, or we're dealing with a notification.subject.type that isn't caught in our if-else statements (it being 'CheckSuite' or 'Discussion')
Currently it's unclear to me what type of notification.subject.type we're dealing with. Since I don't have the issue myself (I can open 'Commented' notifications fine) I can't debug it.
@theherk I think it might be helpful to fork the extension, place a console.log(notification.subject) in the getGithubURL function and check what it says.
I'm digging a little further into the Github REST API docs to see what the type of notifications there are...