Skip to content

Add link to your fork under a repo's title - #1108

Closed
runofthemillgeek wants to merge 1 commit into
refined-github:masterfrom
runofthemillgeek:feat#link-to-fork
Closed

runofthemillgeek wants to merge 1 commit into
refined-github:masterfrom
runofthemillgeek:feat#link-to-fork

Conversation

@runofthemillgeek

@runofthemillgeek runofthemillgeek commented Feb 22, 2018 •

Copy link
Copy Markdown

Note by @bfred-it: I updated this comment to add screenshots and paragraphs.

Fixes: #1129

screen shot 2018-02-26 at 15 28 48

GitHub links upstream repo right below the title of our fork's title when we visit the fork's page. But it doesn't do the same thing on an upstream repo's page, i.e, link to the fork that we created.

IMHO, it is odd that you have to go to the top-right corner and click on the big "Fork" button to switch to your fork. The intention of that button is to create a fork. If I own multiple organizations, clicking on the fork button asks me whether I want to fork under an organization or switch to the fork under my account.

This is an added step to get to where we want and slows things down. I find it natural to expect the link to be below the title given that's how GitHub does it for a fork. This patch will add a link to our fork on upstream's page as soon as the dynamic pages are loaded.

I believe this can be extended in various ways (like a dropdown that shows forks under your orgs) but I want to know if the current implementation is fine and whether you guys think this is a good feature. The implementation currently has one main issue:

  • Default pagination only returns 30 entries and I don't know if GitHub returns the details for logged-in user's fork in the first 30 entries itself.

@fregante

Copy link
Copy Markdown
Member

@fregante

fregante commented Feb 26, 2018 •

Copy link
Copy Markdown
Member

This is an interesting feature, but I have one issue with it: this causes a fetch in every repo I visit, but I rarely have forks for repos I visit. This is also an issue because our API calls are currently key-less so they're heavily rate-limited.

Is there a way to make this happen on demand? For example there could be an extended fork button that is directly linked to your profile:

  • if you have a fork, open it
  • if you don't have a fork, create it

Like this. Regular button is linked to your profile, the arrow opens the regular selector:

instant fork

@fregante

Copy link
Copy Markdown
Member

like a dropdown that shows forks under your orgs

I like this too, might just be able to force the current lightbox into a dropdown, leaving the fetching/populating to GitHub.

I'm also not a fan of the current selector, it's annoying that a fork I already have is smaller than the others. It's like that it's not the right way to reach a fork and GitHub offers a better way... but doesn't?

@runofthemillgeek

Copy link
Copy Markdown
Author

I like your alternative @bfred-it and it makes the current interface less frustrating. However, if I may, my original intention was to avoid placing the action of switching between forks on the fork button. This might be just me but I use the fork button to create new forks and not to switch. Moreover, if viewing my fork and click the fork button, it either:

  1. loads the same page again if you don't have any orgs tied to your account
  2. opens a modal for forking to an org tied to your account if any and a very badly placed link to one's own fork at the bottom of the modal

I believe this makes it seem more like the Fork button is just for creating forks and hence not an trigger to switch between.

GitHub places links to upstream right below our fork's title which might not be the most convenient thing but it's understood. That's why I thought a "forked from ..." might be more desirable than relying on the Fork button's dynamic behavior.

I am inclined to another alternative which I just thought about. What about when you visit the upstream, the Fork button turns into this:

image

This is more clear about what action the Fork button triggers and conveys that a Fork already exists. Like you suggested, the dropdown could also be present if more forks are available in the user's org. However, I hope you get my point about the confusing actions the Fork button can trigger and why I believe to isolate these.

I still think it's clearer to place it below the title, maybe make it a little more visible than just a link and have a dropdown to switch between available forks. And maybe add a dropdown next to the Fork button too, but for creating new forks.

@runofthemillgeek

Copy link
Copy Markdown
Author

@bfred-it I agree with the rate-limiting part. I'm also sorry I didn't open this as an issue and directly made a PR. I didn't think of it through and through and I only did a few research about the various ways of making this possible. Beside the request on every page, I don't think the way I implemented it works for all cases and needs an alternative approach to check if a fork exists. Maybe the details are present on the page itself. Also, since there are a lot of AJAX html being loaded and rendered, once the data about this is initially fetched, should cache it so there's no request going off while on the same repo.

I would love to work on this if we can reach a consensus on how to go ahead with this and what the design should be like.

@fregante

Copy link
Copy Markdown
Member

loads the same page again if you don't have any orgs tied to your account

This is one if away: if currentpage === fork, disable button (users can use the arrow button)

This is more clear about what action the Fork button triggers and conveys that a Fork already exists

This is nice, but it still requires a fetch, so we're back to square one. The suggestion of hiding it behind a button is specifically so the fetch happens only when the user clicks the button.

@runofthemillgeek

Copy link
Copy Markdown
Author

@bfred-it I understand. Basically, you want to avoid any and all possible fetches when the page loads and defer that until the user shows the need for it.

@fregante fregante changed the title Feature: Link user's fork below upstream repo title Add link to your fork under a repo's title Mar 5, 2018
@fregante

fregante commented Mar 5, 2018 •

Copy link
Copy Markdown
Member

Moved comment to issue: #1129 (comment)

@hkdobrev

hkdobrev commented Mar 6, 2018 •

Copy link
Copy Markdown
Contributor

Moved comment to issue: #1129 (comment)

@fregante

Copy link
Copy Markdown
Member

@sangeeth96 is this something you can pick up again following the new suggestions?

@sindresorhus

Copy link
Copy Markdown
Member

@sangeeth96 Friendly ping :)

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

Development

Successfully merging this pull request may close these issues.

4 participants