Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permalinks for volatile links in comments #1448

Closed
sonicdoe opened this issue Jul 28, 2018 · 7 comments · Fixed by #1863
Closed

Permalinks for volatile links in comments #1448

sonicdoe opened this issue Jul 28, 2018 · 7 comments · Fixed by #1863

Comments

@sonicdoe
Copy link

Sometimes I stumble upon comments that link to a specific location on a repository’s default branch. For example: https://github.com/sindresorhus/refined-github/blob/master/source/libs/api.js#L3.

Such links are quite volatile, therefore, it would be awesome if Refined GitHub would add a “View link at the time of this comment” button next to such links.

This would be very similar to the existing “View repo at the time of this comment” functionality (#732), however, it would work for links to specific locations and for links to repositories other than the one where the comment was posted.

@fregante
Copy link
Member

I’m wondering if this should just be automatic. It’s easier to reach the latest version than it is to reach the linked version.

@sindresorhus
Copy link
Member

@bfred-it You are assuming that the commenter meant to link to the commit at the time of the comment, but they might as well have been talking about just a file in general, which they want to show the latest version of.

@fregante
Copy link
Member

fregante commented Sep 14, 2018

That’s why I said it’s easier to reach the latest version than the other way around. I could see why this might not be desirable though.

However if the link points to a line, I’d assume that the author meant that line at that point in time and nothing else.

I can’t think of a sensible way to do this (other than adding yet another icon next to each comment)

Perhaps in the new comment dropdown? Could the previous functionality also be moved in there?

@sindresorhus
Copy link
Member

However if the link points to a line, I’d assume that the author meant that line at that point in time and nothing else.

This I agree with. Here the intention is clear.

@sindresorhus
Copy link
Member

PR welcome.


For anyone that wants this, please also send this feature request to GitHub: support@github.com

@fregante
Copy link
Member

fregante commented Nov 7, 2018

Implemented how? We discussed a few options.

I think the cleanest way would be to give a button to change all the non-perma-links to permalinks. Ideally on the whole thread. Perhaps a keyboard shortcut (as undiscoverable as that may be)

Better yet, add the "code" icon next to all non-perma-links, like we do in the comment headers. Perhaps a bit noisy but pretty straightforward.

@cuschk
Copy link

cuschk commented Dec 12, 2018

After running into links where the line numbers didn't match anymore after some time, I believe that links to code lines should always be permalinks pointing to a specific commit.

I like the way Bitbucket implemented this: When clicking a link to a line of code, the branch name is automatically replaced by the current commit hash in window.location. This way users can always copy a real permalink pointing to the commit. It would be great if that also worked on GitHub.

For existing links in comments or links from users who don't use this great extension, I agree with the proposed solution.

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

Successfully merging a pull request may close this issue.

4 participants