diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index 57937be83e..08b2737a01 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -288,6 +288,7 @@ func CreatePost(ctx *context.Context) { IsTemplate: form.Template, TrustModel: repo_model.DefaultTrustModel, ObjectFormatName: form.ObjectFormatName, + GroupID: form.ParentGroupID, }) if err == nil { log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name) @@ -450,6 +451,7 @@ func SearchRepo(ctx *context.Context) { Template: optional.None[bool](), StarredByID: ctx.FormInt64("starredBy"), IncludeDescription: ctx.FormBool("includeDesc"), + GroupID: ctx.FormInt64("group_id"), } if ctx.FormString("template") != "" { @@ -540,16 +542,18 @@ func SearchRepo(ctx *context.Context) { for i, repo := range repos { results[i] = &repo_service.WebSearchRepository{ Repository: &api.Repository{ - ID: repo.ID, - FullName: repo.FullName(), - Fork: repo.IsFork, - Private: repo.IsPrivate, - Template: repo.IsTemplate, - Mirror: repo.IsMirror, - Stars: repo.NumStars, - HTMLURL: repo.HTMLURL(ctx), - Link: repo.Link(), - Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate, + ID: repo.ID, + FullName: repo.FullName(), + Fork: repo.IsFork, + Private: repo.IsPrivate, + Template: repo.IsTemplate, + Mirror: repo.IsMirror, + Stars: repo.NumStars, + HTMLURL: repo.HTMLURL(ctx), + Link: repo.Link(), + Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate, + GroupSortOrder: repo.GroupSortOrder, + GroupID: repo.GroupID, }, } diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index 3792190a76..a6bbb14bc4 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -43,6 +43,7 @@ type CreateRepoForm struct { ForkSingleBranch string `binding:"MaxSize(255)"` ObjectFormatName string + ParentGroupID int64 } // Validate validates the fields