From 8f171210b99b2c6cecab45dcf23d69ee84bccc4f Mon Sep 17 00:00:00 2001 From: Bwko Date: Wed, 26 Jul 2017 09:17:38 +0200 Subject: [PATCH] Revert "Add ability to fork your own repos (#761)" (#2193) --- options/locale/locale_en-US.ini | 1 + routers/repo/pull.go | 6 ++++++ templates/repo/header.tmpl | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 03d42c2140bd..7fee0c2a994d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -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 diff --git a/routers/repo/pull.go b/routers/repo/pull.go index b17c26e7792e..ad4a01ec9468 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -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) { diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index ed9049130917..db636eb9bd7b 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -32,7 +32,7 @@ {{if .CanBeForked}}
- + {{$.i18n.Tr "repo.fork"}}