From c49dd9de9b1f227c4bb30159d202a958e725d765 Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Tue, 20 Feb 2024 17:11:01 +0800 Subject: [PATCH 1/6] Do not show delete button when time tracker is disabled (#29257) (#29279) Backport #29257 Fix #29233 The delete button of time logs won't be shown when the time tracker is disabled. ![image](https://github.com/go-gitea/gitea/assets/15528715/5cc4e0c9-d2f9-4b8f-a2f5-fe202b94c191) Co-authored-by: KN4CK3R (cherry picked from commit e940443b276fa4f30633902f025fd2adad1b22de) --- templates/repo/issue/view_content/comments_delete_time.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/comments_delete_time.tmpl b/templates/repo/issue/view_content/comments_delete_time.tmpl index 7c01bb4228..95121b0dc7 100644 --- a/templates/repo/issue/view_content/comments_delete_time.tmpl +++ b/templates/repo/issue/view_content/comments_delete_time.tmpl @@ -1,4 +1,4 @@ -{{if .comment.Time}} {{/* compatibility with time comments made before v1.14 */}} +{{if and .comment.Time (.ctxData.Repository.IsTimetrackerEnabled ctx)}} {{/* compatibility with time comments made before v1.14 */}} {{if (not .comment.Time.Deleted)}} {{if (or .ctxData.IsAdmin (and .ctxData.IsSigned (eq .ctxData.SignedUserID .comment.PosterID)))}} From a1fb6a2346193439dafaee5acf071632246e6dd7 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 21 Feb 2024 19:08:34 +0800 Subject: [PATCH 2/6] Always write proc-receive hook for all git versions (#29287) (#29291) Backport #29287 (cherry picked from commit 9379352db638aa99ee9f4a7d2755966f3d866541) --- modules/repository/hooks.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/repository/hooks.go b/modules/repository/hooks.go index daab7c3091..95849789ab 100644 --- a/modules/repository/hooks.go +++ b/modules/repository/hooks.go @@ -9,7 +9,6 @@ import ( "path/filepath" "runtime" - "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" ) @@ -94,15 +93,14 @@ done `, setting.ScriptType, util.ShellEscape(setting.AppPath), util.ShellEscape(setting.CustomConf)), } - if git.SupportProcReceive { - hookNames = append(hookNames, "proc-receive") - hookTpls = append(hookTpls, - fmt.Sprintf(`#!/usr/bin/env %s + // although only new git (>=2.29) supports proc-receive, it's still good to create its hook, in case the user upgrades git + hookNames = append(hookNames, "proc-receive") + hookTpls = append(hookTpls, + fmt.Sprintf(`#!/usr/bin/env %s # AUTO GENERATED BY GITEA, DO NOT MODIFY %s hook --config=%s proc-receive `, setting.ScriptType, util.ShellEscape(setting.AppPath), util.ShellEscape(setting.CustomConf))) - giteaHookTpls = append(giteaHookTpls, "") - } + giteaHookTpls = append(giteaHookTpls, "") return hookNames, hookTpls, giteaHookTpls } From 8a2c4e9ff2743f47a8d1f081b9e35dcc16431115 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 22 Feb 2024 02:40:16 +0800 Subject: [PATCH 3/6] Fix debian InRelease Acquire-By-Hash newline (#29204) (#29299) Backport #29204 Co-authored-by: Robin Schoonover (cherry picked from commit f634982d237b38e0634c5997612f50230898247e) --- services/packages/debian/repository.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/packages/debian/repository.go b/services/packages/debian/repository.go index b968ac2f81..813fef36f8 100644 --- a/services/packages/debian/repository.go +++ b/services/packages/debian/repository.go @@ -341,7 +341,7 @@ func buildReleaseFiles(ctx context.Context, ownerID int64, repoVersion *packages fmt.Fprintf(w, "Components: %s\n", strings.Join(components, " ")) fmt.Fprintf(w, "Architectures: %s\n", strings.Join(architectures, " ")) fmt.Fprintf(w, "Date: %s\n", time.Now().UTC().Format(time.RFC1123)) - fmt.Fprint(w, "Acquire-By-Hash: yes") + fmt.Fprint(w, "Acquire-By-Hash: yes\n") pfds, err := packages_model.GetPackageFileDescriptors(ctx, pfs) if err != nil { From 3a061083d65bdfc9acf0cb5839b84f6a9c17a727 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 22 Feb 2024 03:01:48 +0800 Subject: [PATCH 4/6] Fix missing link on outgoing new release notifications (#29079) (#29300) Backport #29079 Signed-off-by: Wiktor Kwapisiewicz Co-authored-by: Wiktor Kwapisiewicz Co-authored-by: KN4CK3R (cherry picked from commit c4a86b20a4ecef749caed4e9e1381c1736cb0309) --- services/mailer/mail_release.go | 1 + 1 file changed, 1 insertion(+) diff --git a/services/mailer/mail_release.go b/services/mailer/mail_release.go index 983e55a436..e17801be2a 100644 --- a/services/mailer/mail_release.go +++ b/services/mailer/mail_release.go @@ -74,6 +74,7 @@ func mailNewRelease(ctx context.Context, lang string, tos []string, rel *repo_mo "Release": rel, "Subject": subject, "Language": locale.Language(), + "Link": rel.HTMLURL(), } var mailBody bytes.Buffer From 47e70bbf0ea42f21a83b15e669415ed5a1851978 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Thu, 22 Feb 2024 11:53:38 +0900 Subject: [PATCH 5/6] Fix gitea-action user avatar broken on edited menu (#29190) (#29307) Backport #29190 Fix #29178 (cherry picked from commit f80ea95eb538decad4d982ce96f640b18e430393) --- models/issues/content_history.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/models/issues/content_history.go b/models/issues/content_history.go index 8c333bc6dd..8b00adda99 100644 --- a/models/issues/content_history.go +++ b/models/issues/content_history.go @@ -161,7 +161,11 @@ func FetchIssueContentHistoryList(dbCtx context.Context, issueID, commentID int6 } for _, item := range res { - item.UserAvatarLink = avatars.GenerateUserAvatarFastLink(item.UserName, 0) + if item.UserID > 0 { + item.UserAvatarLink = avatars.GenerateUserAvatarFastLink(item.UserName, 0) + } else { + item.UserAvatarLink = avatars.DefaultAvatarLink() + } } return res, nil } From 9a63c6f39aa171726243b606b79a0171deb5ccb0 Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Thu, 22 Feb 2024 10:32:54 +0800 Subject: [PATCH 6/6] Fix error display when merging PRs (#29288) (#29309) Backport #29288 Partially fix #29071, regression of Modernize merge button #28140 Fix some missing `Redirect` -> `JSONRedirect`. Thanks @yp05327 for the help in https://github.com/go-gitea/gitea/issues/29071#issuecomment-1931261075 (cherry picked from commit dcb9c38568dc4e9502fc416de237cce0eac41cba) --- routers/web/repo/pull.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 6b00ec12d8..2c8715ddb8 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -1236,19 +1236,19 @@ func MergePullRequest(ctx *context.Context) { return } ctx.Flash.Error(flashError) - ctx.Redirect(issue.Link()) + ctx.JSONRedirect(issue.Link()) } else if models.IsErrMergeUnrelatedHistories(err) { log.Debug("MergeUnrelatedHistories error: %v", err) ctx.Flash.Error(ctx.Tr("repo.pulls.unrelated_histories")) - ctx.Redirect(issue.Link()) + ctx.JSONRedirect(issue.Link()) } else if git.IsErrPushOutOfDate(err) { log.Debug("MergePushOutOfDate error: %v", err) ctx.Flash.Error(ctx.Tr("repo.pulls.merge_out_of_date")) - ctx.Redirect(issue.Link()) + ctx.JSONRedirect(issue.Link()) } else if models.IsErrSHADoesNotMatch(err) { log.Debug("MergeHeadOutOfDate error: %v", err) ctx.Flash.Error(ctx.Tr("repo.pulls.head_out_of_date")) - ctx.Redirect(issue.Link()) + ctx.JSONRedirect(issue.Link()) } else if git.IsErrPushRejected(err) { log.Debug("MergePushRejected error: %v", err) pushrejErr := err.(*git.ErrPushRejected)