Skip to content

notifications: rewrite subject API URLs to their HTML form#49

Open
AntonNiklasson wants to merge 1 commit into
mainfrom
claude/fix-issue-47-49xMM
Open

notifications: rewrite subject API URLs to their HTML form#49
AntonNiklasson wants to merge 1 commit into
mainfrom
claude/fix-issue-47-49xMM

Conversation

@AntonNiklasson
Copy link
Copy Markdown
Owner

The notifications API returns subject.url as an API URL (e.g.
https://api.github.com/repos/o/r/pulls/1) and doesn't include an
html_url, so pressing 'o' on a notification was opening a raw JSON
endpoint. Derive the HTML URL locally — no extra API calls — and fall
back to a sensible repo-level page for subject types we can't resolve
precisely (Release, Discussion).

Fixes #47

The notifications API returns subject.url as an API URL (e.g.
https://api.github.com/repos/o/r/pulls/1) and doesn't include an
html_url, so pressing 'o' on a notification was opening a raw JSON
endpoint. Derive the HTML URL locally — no extra API calls — and fall
back to a sensible repo-level page for subject types we can't resolve
precisely (Release, Discussion).

Fixes #47
Copilot AI review requested due to automatic review settings May 19, 2026 17:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes notification “open” behavior by converting GitHub Notifications subject.url values (REST API endpoints) into their corresponding HTML URLs so the UI opens the intended issue/PR/commit page without extra API calls.

Changes:

  • Added notificationHtmlUrl() helper to rewrite GitHub API URLs to HTML equivalents (including GHES /api/v3 handling and sensible fallbacks).
  • Updated fetchNotifications() to use the rewritten URL instead of the raw API subject.url.
  • Expanded integration tests to validate URL rewriting and fallbacks.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/server/src/fetchers.ts Adds URL rewrite helper and applies it to notification payload shaping.
packages/server/src/fetchers.integration.test.ts Updates notification shaping test and adds unit-style coverage for URL rewrite behavior (GitHub.com + GHES).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 523 to 526
export async function fetchNotifications(instanceId: string) {
const client = await getClient(instanceId);
const { baseUrl } = await getInstance(instanceId);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notifications: pressing 'o' opens broken (API) URL instead of the issue/PR page

3 participants