Skip to content

Commit 66271a0

Browse files
add group_id field to repo creation forms
1 parent e87e50f commit 66271a0

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

routers/web/repo/repo.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ func CreatePost(ctx *context.Context) {
289289
IsTemplate: form.Template,
290290
TrustModel: repo_model.DefaultTrustModel,
291291
ObjectFormatName: form.ObjectFormatName,
292+
GroupID: form.ParentGroupID,
292293
})
293294
if err == nil {
294295
log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
@@ -477,6 +478,7 @@ func SearchRepo(ctx *context.Context) {
477478
Template: optional.None[bool](),
478479
StarredByID: ctx.FormInt64("starredBy"),
479480
IncludeDescription: ctx.FormBool("includeDesc"),
481+
GroupID: ctx.FormInt64("group_id"),
480482
}
481483

482484
if ctx.FormString("template") != "" {
@@ -567,16 +569,18 @@ func SearchRepo(ctx *context.Context) {
567569
for i, repo := range repos {
568570
results[i] = &repo_service.WebSearchRepository{
569571
Repository: &api.Repository{
570-
ID: repo.ID,
571-
FullName: repo.FullName(),
572-
Fork: repo.IsFork,
573-
Private: repo.IsPrivate,
574-
Template: repo.IsTemplate,
575-
Mirror: repo.IsMirror,
576-
Stars: repo.NumStars,
577-
HTMLURL: repo.HTMLURL(ctx),
578-
Link: repo.Link(),
579-
Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate,
572+
ID: repo.ID,
573+
FullName: repo.FullName(),
574+
Fork: repo.IsFork,
575+
Private: repo.IsPrivate,
576+
Template: repo.IsTemplate,
577+
Mirror: repo.IsMirror,
578+
Stars: repo.NumStars,
579+
HTMLURL: repo.HTMLURL(ctx),
580+
Link: repo.Link(),
581+
Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate,
582+
GroupSortOrder: repo.GroupSortOrder,
583+
GroupID: repo.GroupID,
580584
},
581585
}
582586

services/forms/repo_form.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type CreateRepoForm struct {
4343

4444
ForkSingleBranch string
4545
ObjectFormatName string
46+
ParentGroupID int64
4647
}
4748

4849
// Validate validates the fields

0 commit comments

Comments
 (0)