Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Render GitHub pull requests everywhere we render git commits#48183

Merged
philipp-spiess merged 4 commits into
mainfrom
ps/pulls-everywhere
Feb 27, 2023
Merged

Render GitHub pull requests everywhere we render git commits#48183
philipp-spiess merged 4 commits into
mainfrom
ps/pulls-everywhere

Conversation

@philipp-spiess

@philipp-spiess philipp-spiess commented Feb 24, 2023

Copy link
Copy Markdown
Contributor

Fixed some leftover places that didn't show the git commit messages yet. Thank you for the feedback, @mrnugget.

It turns out this is evne easier because the node already had externalURLs so I can even delete code!

Test plan

Screenshot 2023-02-24 at 12 43 59

Screenshot 2023-02-24 at 12 43 38

Screenshot 2023-02-24 at 12 43 09

Update: The screenshots are slightly outdated, the URLs are fixed now!

App preview:

Check out the client app preview documentation to learn more.

@philipp-spiess philipp-spiess requested review from a team and mrnugget February 24, 2023 12:02
@philipp-spiess philipp-spiess self-assigned this Feb 24, 2023
@cla-bot cla-bot Bot added the cla-signed label Feb 24, 2023
@github-actions github-actions Bot added the team/code-exploration Issues owned by the Code Exploration team label Feb 24, 2023
@philipp-spiess philipp-spiess marked this pull request as draft February 24, 2023 12:03
@philipp-spiess

philipp-spiess commented Feb 24, 2023

Copy link
Copy Markdown
Contributor Author

Wait just checking the links it generated I think they won't work lol

https://github.com/sourcegraph/sourcegraph/commit/ad1ea519e5a31bb868be947107bcf43f4f9fc672/pull/48142

😮‍💨

Edit: fixed

@sg-e2e-regression-test-bob

sg-e2e-regression-test-bob commented Feb 24, 2023

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) -0.00% (-0.01 kb) -0.00% (-0.01 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 81ca0c0 and e5912f4 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@philipp-spiess philipp-spiess marked this pull request as ready for review February 24, 2023 12:22
return match[1]
}

return url

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's the only part that seems "brittle" to me. If the URL doesn't match the pattern it doesn't necessarily mean that url is a GitHub repo URL. I guess the assumption is that the input is always a GitHub URL (and that's currently the case given how it's used) but who knows how someone else uses it in the future.
That said, I don't know if need stricter checks now (and what they would look like) but we should be aware of this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@fkling That's fair! Not sure if you saw this but we aoso have a check on the top though that looks at the ServiceKind exposed from the backend to detect if this resource is indeed hosted on GitHub:

const github = externalURLs ? externalURLs.find(url => url.serviceKind === ExternalServiceKind.GITHUB) : null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't pay attention to that.... in that case I'd probably implement githubRepoUrl to accept whatever type of object github is with the restriction {serviceKind: ExternalServiceKind.GITHUB} (if that's possible at all).

Comment on lines -34 to -35
rel: 'noreferrer noopener',
target: '_blank',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this not needed anymore? Why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Lol, that's only because I’m stupid. The nooper and target _blank should apply to the external URL only (the one that links to GitHub) but I accidentally applied it to the internal part (the one that links the Sorucegraph commit) where obviously this is not expected

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@philipp-spiess philipp-spiess merged commit e6a3b05 into main Feb 27, 2023
@philipp-spiess philipp-spiess deleted the ps/pulls-everywhere branch February 27, 2023 13:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/code-exploration Issues owned by the Code Exploration team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants