From 2b3b94e1dc744223bddd0f823a8f45f40e6cb6c5 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Fri, 10 Jun 2022 10:51:20 +0800 Subject: [PATCH 1/3] fix issue --- templates/repo/create.tmpl | 55 +++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 4b34b8659..936176331 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -15,11 +15,11 @@
{{if .IsForcedPrivate}} - - + + {{else}} - - + + {{end}}
{{.i18n.Tr "repo.visibility_description"}} @@ -42,33 +42,41 @@
- +
-
- +
+
- +
- +
- +
- +
@@ -83,7 +91,8 @@
@@ -98,7 +107,7 @@
{{.i18n.Tr "repo.repo_gitignore_helper"}}
@@ -111,7 +120,7 @@ @@ -124,24 +133,32 @@
{{.i18n.Tr "repo.readme_helper"}}
- +
- + +
+
+
+ + +
-
+
-{{template "base/footer" .}} +{{template "base/footer" .}} \ No newline at end of file From 95bb62104a1592bf5b39a2a3dedf22525663ef91 Mon Sep 17 00:00:00 2001 From: liuzx Date: Fri, 10 Jun 2022 11:12:27 +0800 Subject: [PATCH 2/3] fix-2151 --- modules/auth/repo_form.go | 1 + options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 1 + routers/repo/repo.go | 8 ++++++-- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index ab724e923..9ea5da879 100755 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -46,6 +46,7 @@ type CreateRepoForm struct { Webhooks bool Avatar bool Labels bool + AutoAgree bool } // Validate validates the fields diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c52a369ce..254c7d209 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1179,6 +1179,7 @@ template.topics = Topics template.avatar = Avatar template.issue_labels = Issue Labels template.one_item = Must select at least one template item +template.one_promise = Must agree to use the agreement! template.invalid = Must select a template repository template.repo_adress=Adress template.repo_path=path diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index cb1c7565a..0763b450a 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1189,6 +1189,7 @@ template.topics=主题 template.avatar=头像 template.issue_labels=任务标签 template.one_item=必须至少选择一个模板项 +template.one_promise=创建项目需承诺使用协议! template.invalid=必须选择一个模板项目 template.repo_adress=项目地址 template.repo_path=项目地址 diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 70705dcf1..c0803ed06 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -6,7 +6,6 @@ package repo import ( - "code.gitea.io/gitea/modules/validation" "fmt" "net/url" "os" @@ -15,6 +14,8 @@ import ( "strings" "unicode/utf8" + "code.gitea.io/gitea/modules/validation" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/base" @@ -193,7 +194,10 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) { return } ctx.Data["ContextUser"] = ctxUser - + if !form.AutoAgree { + ctx.RenderWithErr(ctx.Tr("repo.template.one_promise"), tplCreate, form) + return + } if ctx.HasError() { ctx.HTML(200, tplCreate) return From f764d043365cc70aa39dbce4f0463f56091a3ea5 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Fri, 10 Jun 2022 11:14:31 +0800 Subject: [PATCH 3/3] fix issue --- options/locale/locale_en-US.ini | 3 ++- options/locale/locale_zh-CN.ini | 3 ++- templates/repo/create.tmpl | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c52a369ce..7e674f2fd 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2252,7 +2252,8 @@ topic.done = Done topic.count_prompt = You can not select more than 25 topics topic.format_prompt = Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long. imagetopic.format_prompt = Topics can be up to 35 characters long. - +use_repo_agreement=I promise that the content of this warehouse does not violate any national laws and regulations. During the use of the warehouse, I will abide by the OpenI community management regulations and platform usage rules, and will not conduct malicious attacks, mining, or any other illegal or disruptive platform order. Information release and related behaviors. For more information please refer to +openi_use_agreement=OpenI Qizhi Community Platform Use Agreement. [org] org_name_holder = Organization Name org_full_name_holder = Organization Full Name diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index cb1c7565a..0befaa8eb 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2262,7 +2262,8 @@ topic.done=保存 topic.count_prompt=您最多选择25个标签 topic.format_prompt=标签必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符 imagetopic.format_prompt=标签长度不得超过35个字符 - +use_repo_agreement=我承诺此仓内容不违反任何国家法律法规,仓库使用过程中遵守OpenI启智社区管理规定和平台使用规则,不进行恶意攻击、挖矿等任何违法或扰乱平台秩序的信息发布和相关行为。更多信息请参考 +openi_use_agreement=OpenI启智社区平台使用协议 [org] org_name_holder=组织名称 org_full_name_holder=组织全名 diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 936176331..2e1dd51a6 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -153,7 +153,9 @@
- +