diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f9b9a421a372..dc90c6905b9d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,7 @@ - [How to report issues](#how-to-report-issues) - [Types of issues](#types-of-issues) - [Discuss your design before the implementation](#discuss-your-design-before-the-implementation) + - [Issue locking](#issue-locking) - [Building Gitea](#building-gitea) - [Dependencies](#dependencies) - [Backend](#backend) @@ -103,6 +104,13 @@ the goals for the project and tools. Pull requests should not be the place for architecture discussions. +### Issue locking + +Commenting on closed or merged issues/PRs is strongly discouraged. +Such comments will likely be overlooked as some maintainers may not view notifications on closed issues, thinking that the item is resolved. +As such, commenting on closed/merged issues/PRs may be disabled prior to the scheduled auto-locking if a discussion starts or if unrelated comments are posted. +If further discussion is needed, we encourage you to open a new issue instead and we recommend linking to the issue/PR in question for context. + ## Building Gitea See the [development setup instructions](https://docs.gitea.com/development/hacking-on-gitea). diff --git a/modules/context/base.go b/modules/context/base.go index fa05850a166b..ddd04f476745 100644 --- a/modules/context/base.go +++ b/modules/context/base.go @@ -265,6 +265,14 @@ func (b *Base) Redirect(location string, status ...int) { // So in this case, we should remove the session cookie from the response header removeSessionCookieHeader(b.Resp) } + // in case the request is made by htmx, have it redirect the browser instead of trying to follow the redirect inside htmx + if b.Req.Header.Get("HX-Request") == "true" { + b.Resp.Header().Set("HX-Redirect", location) + // we have to return a non-redirect status code so XMLHTTPRequest will not immediately follow the redirect + // so as to give htmx redirect logic a chance to run + b.Status(http.StatusNoContent) + return + } http.Redirect(b.Resp, b.Req, location, code) } diff --git a/modules/templates/mailer.go b/modules/templates/mailer.go index 54d857a8f6e8..04032e398278 100644 --- a/modules/templates/mailer.go +++ b/modules/templates/mailer.go @@ -44,11 +44,17 @@ func buildSubjectBodyTemplate(stpl *texttmpl.Template, btpl *template.Template, } if _, err := stpl.New(name). Parse(string(subjectContent)); err != nil { - log.Warn("Failed to parse template [%s/subject]: %v", name, err) + log.Error("Failed to parse template [%s/subject]: %v", name, err) + if !setting.IsProd { + log.Fatal("Please fix the mail template error") + } } if _, err := btpl.New(name). Parse(string(bodyContent)); err != nil { - log.Warn("Failed to parse template [%s/body]: %v", name, err) + log.Error("Failed to parse template [%s/body]: %v", name, err) + if !setting.IsProd { + log.Fatal("Please fix the mail template error") + } } } diff --git a/routers/private/hook_post_receive.go b/routers/private/hook_post_receive.go index 8b954a8130ce..5ae03ce294b5 100644 --- a/routers/private/hook_post_receive.go +++ b/routers/private/hook_post_receive.go @@ -159,7 +159,7 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) { } // If we've pushed a branch (and not deleted it) - if git.IsEmptyCommitID(newCommitID) && refFullName.IsBranch() { + if !git.IsEmptyCommitID(newCommitID) && refFullName.IsBranch() { // First ensure we have the repository loaded, we're allowed pulls requests and we can get the base repo if repo == nil { repo = loadRepository(ctx, ownerName, repoName) diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index c20335af6f30..b248af1d0183 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -117,6 +117,9 @@ func notify(ctx context.Context, input *notifyInput) error { log.Debug("ignore executing %v for event %v whose doer is %v", getMethod(ctx), input.Event, input.Doer.Name) return nil } + if input.Repo.IsEmpty { + return nil + } if unit_model.TypeActions.UnitGlobalDisabled() { if err := actions_model.CleanRepoScheduleTasks(ctx, input.Repo); err != nil { log.Error("CleanRepoScheduleTasks: %v", err) diff --git a/templates/mail/notify/repo_transfer.tmpl b/templates/mail/notify/repo_transfer.tmpl index 597048ddf496..8c8b276484e1 100644 --- a/templates/mail/notify/repo_transfer.tmpl +++ b/templates/mail/notify/repo_transfer.tmpl @@ -5,7 +5,7 @@ {{.Subject}} -{{$url := HTMLFormat "%[2]s" .Link .Repo)}} +{{$url := HTMLFormat "%[2]s" .Link .Repo}}

{{.Subject}}. {{.locale.Tr "mail.repo.transfer.body" $url}} diff --git a/templates/repo/editor/patch.tmpl b/templates/repo/editor/patch.tmpl index c9a78cc35fdf..8df87589889b 100644 --- a/templates/repo/editor/patch.tmpl +++ b/templates/repo/editor/patch.tmpl @@ -14,8 +14,8 @@

{{.BranchName}} {{ctx.Locale.Tr "repo.editor.or"}} {{ctx.Locale.Tr "repo.editor.cancel_lower"}} - - + +