Skip to content

Only show "You cannot fork a repository you own" when needed. #4130

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

Merged
merged 5 commits into from Jun 9, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/repo/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</div>
{{if .CanBeForked}}
<div class="ui compact labeled button" tabindex="0">
<a class="ui compact button {{if not $.CanSignedUserFork}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
<a class="ui compact button {{if not $.CanSignedUserFork}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else if $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
Copy link
Member

@daviian daviian Jun 5, 2018

Choose a reason for hiding this comment

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

Wouldn't it be much more clearer if we check IsSigned in the same ifs as CanSignedUserFork?

Copy link

@oszilloskop oszilloskop Jun 5, 2018

Choose a reason for hiding this comment

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

[No code review text]
I'm not understand much but here is the view of a normal user:
It would be great if the behavior is identical to the neighboring buttons "Watch" and "Star".
When I press one of those two buttons I'm asked to sign in.
[/No code review text]

Copy link
Member

@axifive axifive Jun 6, 2018

Choose a reason for hiding this comment

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

@daviian It doesn't work out(

Copy link
Author

Choose a reason for hiding this comment

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

@daviian I keep it in else if because logic I use is:

if user can fork & signed in: let them click link
if user can't for & signed in: show them message letting them know not able to fork
if user not signed in: show fork butt with number of forks, but don't let them click

Copy link

@oszilloskop oszilloskop Jun 6, 2018

Choose a reason for hiding this comment

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

@flufmonster

if user not signed in: let them click and offer the same behavior like the neighboring buttons "Watch" and "Star".

This would create an uniform operation of all those three buttons at the right upper corner.

Copy link
Author

Choose a reason for hiding this comment

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

@oszilloskop sadly we don't know if when the user logs in they can fork, so if we send them to login then it might create a poor experience for them.

<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
</a>
<a class="ui basic label" href="{{.Link}}/forks">
Expand Down