소스 검색

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

But can still fork to organizations.
Unknwon 8 년 전
부모
커밋
4d90527a6e
3개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      conf/locale/locale_en-US.ini
  2. 1 1
      modules/bindata/bindata.go
  3. 6 0
      routers/repo/pull.go

+ 1 - 0
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.

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
modules/bindata/bindata.go


+ 6 - 0
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

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.