From c08d263a1900aa5ee92f56af8ad1c7a2697d02e1 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 16 Jan 2024 20:54:48 +0800 Subject: [PATCH] Remove trust model selection from repository creation on web page because it can be changed in settings later (#28814) As more and more options can be set for creating the repository, I don't think we should put all of them into the creation web page which will make things look complicated and confusing. And I think we need some rules about how to decide which should/should not be put in creating a repository page. One rule I can imagine is if this option can be changed later and it's not a MUST on the creation, then it can be removed on the page. So I found trust model is the first one. This PR removed the trust model selections on creating a repository web page and kept others as before. This is also a preparation for #23894 which will add a choice about SHA1 or SHA256 that cannot be changed once the repository created. --- routers/web/repo/repo.go | 2 +- services/forms/repo_form.go | 8 -------- templates/repo/create.tmpl | 26 +------------------------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index cd5eac057..b5c550ae4 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -288,7 +288,7 @@ func CreatePost(ctx *context.Context) { DefaultBranch: form.DefaultBranch, AutoInit: form.AutoInit, IsTemplate: form.Template, - TrustModel: repo_model.ToTrustModel(form.TrustModel), + TrustModel: repo_model.DefaultTrustModel, ObjectFormatName: form.ObjectFormatName, }) if err == nil { diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index 780fc8800..845eccf81 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -21,13 +21,6 @@ import ( "gitea.com/go-chi/binding" ) -// _______________________________________ _________.______________________ _______________.___. -// \______ \_ _____/\______ \_____ \ / _____/| \__ ___/\_____ \\______ \__ | | -// | _/| __)_ | ___// | \ \_____ \ | | | | / | \| _// | | -// | | \| \ | | / | \/ \| | | | / | \ | \\____ | -// |____|_ /_______ / |____| \_______ /_______ /|___| |____| \_______ /____|_ // ______| -// \/ \/ \/ \/ \/ \/ \/ - // CreateRepoForm form for creating repository type CreateRepoForm struct { UID int64 `binding:"Required"` @@ -50,7 +43,6 @@ type CreateRepoForm struct { Avatar bool Labels bool ProtectedBranch bool - TrustModel string ForkSingleBranch string ObjectFormatName string diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 7b2e51130..3b4b994be 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -61,7 +61,7 @@
- +
@@ -185,29 +185,6 @@ {{ctx.Locale.Tr "repo.default_branch_helper"}}
-
- - -
- {{ctx.Locale.Tr "repo.trust_model_helper"}} -
    -
  • {{ctx.Locale.Tr "repo.trust_model_helper_collaborator"}}
  • -
  • {{ctx.Locale.Tr "repo.trust_model_helper_committer"}}
  • -
  • {{ctx.Locale.Tr "repo.trust_model_helper_collaborator_committer"}}
  • -
  • {{ctx.Locale.Tr "repo.trust_model_helper_default"}}
  • -
-
-
@@ -216,7 +193,6 @@
-