Browse Source

repo: does not allow fork to original owner (#4182)

But can still fork to organizations.
pull/3853/merge
Unknwon 8 years ago
parent
commit
4d90527a6e
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 1
      conf/locale/locale_en-US.ini
  2. 6
      modules/bindata/bindata.go
  3. 6
      routers/repo/pull.go

1
conf/locale/locale_en-US.ini

@ -688,6 +688,7 @@ settings.tracker_issue_style.alphanumeric = Alphanumeric
settings.tracker_url_format_desc = You can use placeholder <code>{user} {repo} {index}</code> for user name, repository name and issue index.
settings.pulls_desc = Enable pull requests to accept public contributions
settings.danger_zone = Danger Zone
settings.cannot_fork_to_same_owner = You cannot fork a repository to its original owner.
settings.new_owner_has_same_repo = The new owner already has a repository with same name. Please choose another name.
settings.convert = Convert To Regular Repository
settings.convert_desc = You can convert this mirror to a regular repository. This cannot be reversed.

6
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

6
routers/repo/pull.go

@ -118,6 +118,12 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
}
}
// Cannot fork to same owner
if ctxUser.ID == forkRepo.OwnerID {
ctx.RenderWithErr(ctx.Tr("repo.settings.cannot_fork_to_same_owner"), FORK, &form)
return
}
repo, err := models.ForkRepository(ctxUser, forkRepo, form.RepoName, form.Description)
if err != nil {
ctx.Data["Err_RepoName"] = true

Loading…
Cancel
Save