Refined-github: "View file on fork" link in file view

Created on 19 Feb 2020  Â·  10Comments  Â·  Source: sindresorhus/refined-github

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.

enhancement help wanted

All 10 comments

PR welcome :)

Since it's very very similar, I'm also gonna add here the "Edit on fork" button suggestion from #2812 :)

“View on fork” would bring you to a page where all the actions are available.

2815 already would let you “Edit on fork”. Keep in mind that “View on fork” might already need a fork selector so let’s not clutter the UI with complex components.

Yes, but "View on fork" requires you to go through one more step to go to "Edit on fork" page in comparison to direct button. Yes, you can get probably get used to it but imo it might be an annoyance.

Keep in mind that “View on fork” might already need a fork selector

Wouldn't they share that fork selector though?

Right but we can’t add 100 buttons because they all let you skip a step. As mentioned you can skip the step with #2815 already.

Also don’t merge topics that have already been closed. https://github.com/sindresorhus/refined-github/issues/2812

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.

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.

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

Brilliant and simple idea

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hkdobrev picture hkdobrev  Â·  3Comments

hkdobrev picture hkdobrev  Â·  3Comments

mareksuscak picture mareksuscak  Â·  3Comments

sompylasar picture sompylasar  Â·  3Comments

durka picture durka  Â·  3Comments