Revert "Add ability to fork your own repos (#761)" (#2193)

This commit is contained in:
Bwko 2017-07-26 09:17:38 +02:00 committed by Lunny Xiao
parent 48898e5d0b
commit 8f171210b9
3 changed files with 8 additions and 1 deletions

View file

@ -492,6 +492,7 @@ migrate.lfs_mirror_unsupported = Mirroring LFS objects is not supported - use 'g
mirror_from = mirror of mirror_from = mirror of
forked_from = forked from forked_from = forked from
fork_from_self = You cannot fork a repository you already own!
copy_link = Copy copy_link = Copy
copy_link_success = Copied! copy_link_success = Copied!
copy_link_error = Press ⌘-C or Ctrl-C to copy copy_link_error = Press ⌘-C or Ctrl-C to copy

View file

@ -111,6 +111,12 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
return return
} }
repo, has := models.HasForkedRepo(ctxUser.ID, forkRepo.ID)
if has {
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
return
}
// Check ownership of organization. // Check ownership of organization.
if ctxUser.IsOrganization() { if ctxUser.IsOrganization() {
if !ctxUser.IsOwnedBy(ctx.User.ID) { if !ctxUser.IsOwnedBy(ctx.User.ID) {

View file

@ -32,7 +32,7 @@
</div> </div>
{{if .CanBeForked}} {{if .CanBeForked}}
<div class="ui compact labeled button" tabindex="0"> <div class="ui compact labeled button" tabindex="0">
<a class="ui compact button" href="{{AppSubUrl}}/repo/fork/{{.ID}}"> <a class="ui compact button {{if eq .OwnerID $.SignedUserID}}poping up{{end}}" {{if not (eq .OwnerID $.SignedUserID)}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}} <i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
</a> </a>
<a class="ui basic label" href="{{.Link}}/forks"> <a class="ui basic label" href="{{.Link}}/forks">