Browse Source

repo: fix issue of fork repository no check the limit of users' repository (#5346)

pull/5380/head
GeekComb 7 years ago committed by 无闻
parent
commit
c9bb33afc3
  1. 4
      models/repo.go
  2. 2
      routes/repo/pull.go

4
models/repo.go

@ -2348,6 +2348,10 @@ func HasForkedRepo(ownerID, repoID int64) (*Repository, bool, error) {
// ForkRepository creates a fork of target repository under another user domain.
func ForkRepository(doer, owner *User, baseRepo *Repository, name, desc string) (_ *Repository, err error) {
if !owner.CanCreateRepo() {
return nil, errors.ReachLimitOfRepo{owner.RepoCreationNum()}
}
repo := &Repository{
OwnerID: owner.ID,
Owner: owner,

2
routes/repo/pull.go

@ -126,6 +126,8 @@ func ForkPost(c *context.Context, f form.CreateRepo) {
if err != nil {
c.Data["Err_RepoName"] = true
switch {
case errors.IsReachLimitOfRepo(err):
c.RenderWithErr(c.Tr("repo.form.reach_limit_of_creation", c.User.RepoCreationNum()), FORK, &f)
case models.IsErrRepoAlreadyExist(err):
c.RenderWithErr(c.Tr("repo.settings.new_owner_has_same_repo"), FORK, &f)
case models.IsErrNameReserved(err):

Loading…
Cancel
Save