Skip to content

Commit 9bfa42a

Browse files
authored
Merge branch 'main' into breaking-template
2 parents 773c9cc + cee08f6 commit 9bfa42a

File tree

12 files changed

+24
-37
lines changed

12 files changed

+24
-37
lines changed

custom/conf/app.example.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,12 @@ LEVEL = Info
956956
;GO_GET_CLONE_URL_PROTOCOL = https
957957
;;
958958
;; Close issues as long as a commit on any branch marks it as fixed
959+
;DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH = false
960+
;;
961+
;; Allow users to push local repositories to Gitea and have them automatically created for a user or an org
962+
;ENABLE_PUSH_CREATE_USER = false
963+
;ENABLE_PUSH_CREATE_ORG = false
964+
;;
959965
;; Comma separated list of globally disabled repo units. Allowed values: repo.issues, repo.ext_issues, repo.pulls, repo.wiki, repo.ext_wiki, repo.projects, repo.packages, repo.actions.
960966
;DISABLED_REPO_UNITS =
961967
;;

modules/actions/task_state.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ func FullSteps(task *actions_model.ActionTask) []*actions_model.ActionTaskStep {
3535
} else if task.Status.IsDone() {
3636
preStep.Stopped = task.Stopped
3737
preStep.Status = actions_model.StatusFailure
38+
if task.Status.IsSkipped() {
39+
preStep.Status = actions_model.StatusSkipped
40+
}
3841
}
3942
logIndex += preStep.LogLength
4043

routers/web/repo/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func getRepository(ctx *context.Context, repoID int64) *repo_model.Repository {
112112
}
113113

114114
func getForkRepository(ctx *context.Context) *repo_model.Repository {
115-
forkRepo := getRepository(ctx, ctx.ParamsInt64(":repoid"))
115+
forkRepo := ctx.Repo.Repository
116116
if ctx.Written() {
117117
return nil
118118
}

routers/web/web.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -956,10 +956,6 @@ func registerRoutes(m *web.Route) {
956956
m.Post("/create", web.Bind(forms.CreateRepoForm{}), repo.CreatePost)
957957
m.Get("/migrate", repo.Migrate)
958958
m.Post("/migrate", web.Bind(forms.MigrateRepoForm{}), repo.MigratePost)
959-
m.Group("/fork", func() {
960-
m.Combo("/{repoid}").Get(repo.Fork).
961-
Post(web.Bind(forms.CreateRepoForm{}), repo.ForkPost)
962-
}, context.RepoIDAssignment(), context.UnitTypes(), reqRepoCodeReader)
963959
m.Get("/search", repo.SearchRepo)
964960
}, reqSignIn)
965961

@@ -1255,6 +1251,8 @@ func registerRoutes(m *web.Route) {
12551251
m.Post("/delete", repo.DeleteBranchPost)
12561252
m.Post("/restore", repo.RestoreBranchPost)
12571253
}, context.RepoMustNotBeArchived(), reqRepoCodeWriter, repo.MustBeNotEmpty)
1254+
1255+
m.Combo("/fork", reqRepoCodeReader).Get(repo.Fork).Post(web.Bind(forms.CreateRepoForm{}), repo.ForkPost)
12581256
}, reqSignIn, context.RepoAssignment, context.UnitTypes())
12591257

12601258
// Tags

services/context/repo.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -408,26 +408,6 @@ func repoAssignment(ctx *Context, repo *repo_model.Repository) {
408408
ctx.Data["IsEmptyRepo"] = ctx.Repo.Repository.IsEmpty
409409
}
410410

411-
// RepoIDAssignment returns a handler which assigns the repo to the context.
412-
func RepoIDAssignment() func(ctx *Context) {
413-
return func(ctx *Context) {
414-
repoID := ctx.ParamsInt64(":repoid")
415-
416-
// Get repository.
417-
repo, err := repo_model.GetRepositoryByID(ctx, repoID)
418-
if err != nil {
419-
if repo_model.IsErrRepoNotExist(err) {
420-
ctx.NotFound("GetRepositoryByID", nil)
421-
} else {
422-
ctx.ServerError("GetRepositoryByID", err)
423-
}
424-
return
425-
}
426-
427-
repoAssignment(ctx, repo)
428-
}
429-
}
430-
431411
// RepoAssignment returns a middleware to handle repository assignment
432412
func RepoAssignment(ctx *Context) context.CancelFunc {
433413
if _, repoAssignmentOnce := ctx.Data["repoAssignmentExecuted"]; repoAssignmentOnce {

templates/repo/diff/comments.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
6464
<div class="edit-content-zone gt-hidden" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-context="{{$.root.RepoLink}}" data-attachment-url="{{$.root.RepoLink}}/comments/{{.ID}}/attachments"></div>
6565
{{if .Attachments}}
66-
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Attachments "Content" .RenderedContent}}
66+
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Attachments "RenderedContent" .RenderedContent}}
6767
{{end}}
6868
</div>
6969
{{$reactions := .Reactions.GroupByType}}

templates/repo/header.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
{{/*else is not required here, because the button shouldn't link to any site if you can't create a fork*/}}
8383
{{end}}
8484
{{else if not $.UserAndOrgForks}}
85-
href="{{AppSubUrl}}/repo/fork/{{.ID}}"
85+
href="{{$.RepoLink}}/fork"
8686
{{else}}
8787
data-modal="#fork-repo-modal"
8888
{{end}}
@@ -103,7 +103,7 @@
103103
</div>
104104
{{if $.CanSignedUserFork}}
105105
<div class="divider"></div>
106-
<a href="{{AppSubUrl}}/repo/fork/{{.ID}}">{{ctx.Locale.Tr "repo.fork_to_different_account"}}</a>
106+
<a href="{{$.RepoLink}}/fork">{{ctx.Locale.Tr "repo.fork_to_different_account"}}</a>
107107
{{end}}
108108
</div>
109109
</div>

templates/repo/issue/view_content.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<div id="issue-{{.Issue.ID}}-raw" class="raw-content gt-hidden">{{.Issue.Content}}</div>
6363
<div class="edit-content-zone gt-hidden" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div>
6464
{{if .Issue.Attachments}}
65-
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}}
65+
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Issue.Attachments "RenderedContent" .Issue.RenderedContent}}
6666
{{end}}
6767
</div>
6868
{{$reactions := .Issue.Reactions.GroupByType}}

templates/repo/issue/view_content/attachments.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="gt-f1 gt-p-3">
99
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}">
1010
{{if FilenameIsImage .Name}}
11-
{{if not (StringUtils.Contains (StringUtils.ToString $.Content) .UUID)}}
11+
{{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}}
1212
{{$hasThumbnails = true}}
1313
{{end}}
1414
{{svg "octicon-file"}}
@@ -29,7 +29,7 @@
2929
<div class="ui small thumbnails">
3030
{{- range .Attachments -}}
3131
{{if FilenameIsImage .Name}}
32-
{{if not (StringUtils.Contains (StringUtils.ToString $.Content) .UUID)}}
32+
{{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}}
3333
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}">
3434
<img alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}">
3535
</a>

templates/repo/issue/view_content/comments.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
7070
<div class="edit-content-zone gt-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
7171
{{if .Attachments}}
72-
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Attachments "Content" .RenderedContent}}
72+
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Attachments "RenderedContent" .RenderedContent}}
7373
{{end}}
7474
</div>
7575
{{$reactions := .Reactions.GroupByType}}
@@ -440,7 +440,7 @@
440440
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
441441
<div class="edit-content-zone gt-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
442442
{{if .Attachments}}
443-
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Attachments "Content" .RenderedContent}}
443+
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Attachments "RenderedContent" .RenderedContent}}
444444
{{end}}
445445
</div>
446446
{{$reactions := .Reactions.GroupByType}}

templates/repo/issue/view_content/conversation.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
9696
<div class="edit-content-zone gt-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
9797
{{if .Attachments}}
98-
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Attachments "Content" .RenderedContent}}
98+
{{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Attachments "RenderedContent" .RenderedContent}}
9999
{{end}}
100100
</div>
101101
{{$reactions := .Reactions.GroupByType}}

tests/integration/repo_fork_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ func testRepoFork(t *testing.T, session *TestSession, ownerName, repoName, forkO
2929

3030
// Step2: click the fork button
3131
htmlDoc := NewHTMLParser(t, resp.Body)
32-
link, exists := htmlDoc.doc.Find("a.ui.button[href^=\"/repo/fork/\"]").Attr("href")
32+
link, exists := htmlDoc.doc.Find(`a.ui.button[href*="/fork"]`).Attr("href")
3333
assert.True(t, exists, "The template has changed")
3434
req = NewRequest(t, "GET", link)
3535
resp = session.MakeRequest(t, req, http.StatusOK)
3636

3737
// Step3: fill the form of the forking
3838
htmlDoc = NewHTMLParser(t, resp.Body)
39-
link, exists = htmlDoc.doc.Find("form.ui.form[action^=\"/repo/fork/\"]").Attr("action")
39+
link, exists = htmlDoc.doc.Find(`form.ui.form[action*="/fork"]`).Attr("action")
4040
assert.True(t, exists, "The template has changed")
4141
_, exists = htmlDoc.doc.Find(fmt.Sprintf(".owner.dropdown .item[data-value=\"%d\"]", forkOwner.ID)).Attr("data-value")
4242
assert.True(t, exists, fmt.Sprintf("Fork owner '%s' is not present in select box", forkOwnerName))
@@ -70,6 +70,6 @@ func TestRepoForkToOrg(t *testing.T) {
7070
req := NewRequest(t, "GET", "/user2/repo1")
7171
resp := session.MakeRequest(t, req, http.StatusOK)
7272
htmlDoc := NewHTMLParser(t, resp.Body)
73-
_, exists := htmlDoc.doc.Find("a.ui.button[href^=\"/repo/fork/\"]").Attr("href")
73+
_, exists := htmlDoc.doc.Find(`a.ui.button[href*="/fork"]`).Attr("href")
7474
assert.False(t, exists, "Forking should not be allowed anymore")
7575
}

0 commit comments

Comments
 (0)