Skip to content

Commit c08d263

Browse files
authored
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.
1 parent 930e38d commit c08d263

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

routers/web/repo/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func CreatePost(ctx *context.Context) {
288288
DefaultBranch: form.DefaultBranch,
289289
AutoInit: form.AutoInit,
290290
IsTemplate: form.Template,
291-
TrustModel: repo_model.ToTrustModel(form.TrustModel),
291+
TrustModel: repo_model.DefaultTrustModel,
292292
ObjectFormatName: form.ObjectFormatName,
293293
})
294294
if err == nil {

services/forms/repo_form.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ import (
2121
"gitea.com/go-chi/binding"
2222
)
2323

24-
// _______________________________________ _________.______________________ _______________.___.
25-
// \______ \_ _____/\______ \_____ \ / _____/| \__ ___/\_____ \\______ \__ | |
26-
// | _/| __)_ | ___// | \ \_____ \ | | | | / | \| _// | |
27-
// | | \| \ | | / | \/ \| | | | / | \ | \\____ |
28-
// |____|_ /_______ / |____| \_______ /_______ /|___| |____| \_______ /____|_ // ______|
29-
// \/ \/ \/ \/ \/ \/ \/
30-
3124
// CreateRepoForm form for creating repository
3225
type CreateRepoForm struct {
3326
UID int64 `binding:"Required"`
@@ -50,7 +43,6 @@ type CreateRepoForm struct {
5043
Avatar bool
5144
Labels bool
5245
ProtectedBranch bool
53-
TrustModel string
5446

5547
ForkSingleBranch string
5648
ObjectFormatName string

templates/repo/create.tmpl

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
</div>
6262
<div class="inline field {{if .Err_Description}}error{{end}}">
6363
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
64-
<textarea id="description" name="description" placeholder="{{ctx.Locale.Tr "repo.repo_desc_helper"}}" maxlength="2048">{{.description}}</textarea>
64+
<textarea id="description" rows="2" name="description" placeholder="{{ctx.Locale.Tr "repo.repo_desc_helper"}}" maxlength="2048">{{.description}}</textarea>
6565
</div>
6666
<div class="inline field">
6767
<label>{{ctx.Locale.Tr "repo.template"}}</label>
@@ -185,29 +185,6 @@
185185
<input id="default_branch" name="default_branch" value="{{.default_branch}}" placeholder="{{.default_branch}}">
186186
<span class="help">{{ctx.Locale.Tr "repo.default_branch_helper"}}</span>
187187
</div>
188-
<div class="inline field">
189-
<label>{{ctx.Locale.Tr "repo.settings.trust_model"}}</label>
190-
<div class="ui selection owner dropdown">
191-
<input type="hidden" id="trust_model" name="trust_model" value="default" required>
192-
<div class="default text">{{ctx.Locale.Tr "repo.settings.trust_model"}}</div>
193-
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
194-
<div class="menu">
195-
<div class="item" data-value="default">{{ctx.Locale.Tr "repo.settings.trust_model.default"}}</div>
196-
<div class="item" data-value="collaborator">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator"}}</div>
197-
<div class="item" data-value="committer">{{ctx.Locale.Tr "repo.settings.trust_model.committer"}}</div>
198-
<div class="item" data-value="collaboratorcommitter">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter"}}</div>
199-
</div>
200-
</div>
201-
<div class="help">
202-
{{ctx.Locale.Tr "repo.trust_model_helper"}}
203-
<ul>
204-
<li>{{ctx.Locale.Tr "repo.trust_model_helper_collaborator"}}</li>
205-
<li>{{ctx.Locale.Tr "repo.trust_model_helper_committer"}}</li>
206-
<li>{{ctx.Locale.Tr "repo.trust_model_helper_collaborator_committer"}}</li>
207-
<li>{{ctx.Locale.Tr "repo.trust_model_helper_default"}}</li>
208-
</ul>
209-
</div>
210-
</div>
211188
<div class="inline field">
212189
<label>{{ctx.Locale.Tr "repo.template"}}</label>
213190
<div class="ui checkbox">
@@ -216,7 +193,6 @@
216193
</div>
217194
</div>
218195
</div>
219-
220196
<br>
221197
<div class="inline field">
222198
<label></label>

0 commit comments

Comments
 (0)