Skip to content

Commit

Permalink
Revert "Add ability to fork your own repos (#761)" (#2193)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bwko authored and lunny committed Jul 26, 2017
1 parent 48898e5 commit 8f17121
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ migrate.lfs_mirror_unsupported = Mirroring LFS objects is not supported - use 'g
mirror_from = mirror of
forked_from = forked from
fork_from_self = You cannot fork a repository you already own!
copy_link = Copy
copy_link_success = Copied!
copy_link_error = Press ⌘-C or Ctrl-C to copy
Expand Down
6 changes: 6 additions & 0 deletions routers/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
return
}

repo, has := models.HasForkedRepo(ctxUser.ID, forkRepo.ID)
if has {
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
return
}

// Check ownership of organization.
if ctxUser.IsOrganization() {
if !ctxUser.IsOwnedBy(ctx.User.ID) {
Expand Down
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" 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"}}
</a>
<a class="ui basic label" href="{{.Link}}/forks">
Expand Down

0 comments on commit 8f17121

Please sign in to comment.