Skip to content

[FIX]: PR view loads private-repo pull requests, diffs and files - #164

Open
austin-rt wants to merge 2 commits into
RocketChat:mainfrom
austin-rt:fix/pr-view-private-repos
Open

austin-rt wants to merge 2 commits into
RocketChat:mainfrom
austin-rt:fix/pr-view-private-repos

Conversation

@austin-rt

@austin-rt austin-rt commented Oct 2, 2026 •

Copy link
Copy Markdown

Issue(s)

Closes #160
Related to #19, #21, #140, #141

Acceptance Criteria fulfillment

  • A logged-in user sees a private-repo pull request in the PR view, from the pulls command and from the View Changes button in search results
  • View Changes and View File show a private repository's diff and files
  • A revoked or expired token no longer breaks the PR view on public repositories
  • A logged-out user who opens a private-repo pull request is told to log in

Proposed changes (including videos or screenshots)

  • modals/pullDetailsModal.ts takes the user's token and sends it on both requests, the way lib/pullReqeustListMessage.ts and lib/repoDataMessage.ts already do. If GitHub answers 401, it retries without the token, so a revoked or expired token does not break public repositories. When the request had no token, the "doesn't exist" message also says to log in.
  • modals/fileCodeModal.ts fetches diffs and files through the GitHub API with the token. The button value is a github.com link that comes back from the client, so the token only goes to an API URL rebuilt from that link's owner, repo, number or commit and path, never to the link itself. Any other link is fetched without the token, as before.
  • lib/commandUtility.ts and handlers/ExecuteBlockActionHandler.ts pass the logged-in user's token.

Further comments

The PR view fetched the pull request and its files from the GitHub API
without the user's token, so a private repository answered 404 and the
view said the pull request does not exist. Pass the logged-in user's
token from both places that open the view, the pulls command and the
View Changes button.
- A revoked or expired token gets 401 even on a public repository, so
  the PR view retries without it instead of failing.
- A logged-out user who opens a private-repo PR is told to log in
  instead of only being told the PR does not exist.
- View Changes and View File fetch private-repo diffs and files through
  the GitHub API with the user's token. The token only goes to an API
  URL rebuilt from the github.com link, never to the link itself, since
  the link comes back from the client.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

PR view says a pull request in a private repository doesn't exist

2 participants