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

"View file on fork" link in file view #2810

Closed
Jackenmen opened this issue Feb 19, 2020 · 10 comments · Fixed by #3216
Closed

"View file on fork" link in file view #2810

Jackenmen opened this issue Feb 19, 2020 · 10 comments · Fixed by #3216

Comments

@Jackenmen
Copy link
Contributor

E.g. file view page, like:
https://github.com/sindresorhus/refined-github/blob/master/source/options.html
would have a "View file on fork" link (button) which would redirect you to the file on your fork, i.e. for me it would be (assuming I would have a fork of this repo):
https://github.com/jack1142/refined-github/blob/master/source/options.html
If user doesn't have the fork yet, either the button should not be available or it should also create the fork for the user.

@sindresorhus
Copy link
Member

PR welcome :)

@Jackenmen

This comment has been minimized.

@fregante

This comment has been minimized.

@Jackenmen

This comment has been minimized.

@fregante

This comment has been minimized.

@fregante
Copy link
Member

Back to this topic: I think this feature can be part of forked-to

The forks we list could point to the same view (in this case, the same file) instead of opening the fork’s homepage.

We already have this behavior for links under the More menu, where compare for example isn’t a mere link to the Compare page but also uses the current branch, if any.

@yakov116
Copy link
Member

yakov116 commented Jun 10, 2020

Food for thought.

I was thinking about this. We dont know what branch to open the file on. I think the best way to do this is by copying how comments-time-machine-links works and ask the user if they would like to open the file they were just using.

@fregante
Copy link
Member

fregante commented Jun 10, 2020

We dont know what branch to open the file on.

HEAD

I think we should just alter the existing link if isSingleFile or isRepoTree.

For example, on this page:

// https://github.com/yakov116/refined-github/tree/123/media

The "forked from sindresorhus/refined-github" link:

Should point to:

// https://github.com/sindresorhus/refined-github/tree/HEAD/media

@yakov116
Copy link
Member

Brilliant and simple idea

@fregante
Copy link
Member

fregante commented Jun 10, 2020

The same concept can be applied to forked-to, in the other direction, which is actually what this issue is about.

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