Skip to content

Commit 083ac08

Browse files
authored
Merge branch 'main' into try-fix-acme-3
2 parents 9ac6e79 + e7cf62f commit 083ac08

File tree

10 files changed

+178
-160
lines changed

10 files changed

+178
-160
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ This changelog goes through the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.com).
66

7+
## [1.23.5](https://github.com/go-gitea/gitea/releases/tag/v1.23.5) - 2025-03-04
8+
9+
* SECURITY
10+
* Bump x/oauth2 & x/crypto (#33704) (#33727)
11+
* PERFORMANCE
12+
* Optimize user dashboard loading (#33686) (#33708)
13+
* BUGFIXES
14+
* Fix navbar dropdown item align (#33782)
15+
* Fix inconsistent closed issue list icon (#33722) (#33728)
16+
* Fix for Maven Package Naming Convention Handling (#33678) (#33679)
17+
* Improve Open-with URL encoding (#33666) (#33680)
18+
* Deleting repository should unlink all related packages (#33653) (#33673)
19+
* Fix omitempty bug (#33663) (#33670)
20+
* Upgrade go-crypto from 1.1.4 to 1.1.6 (#33745) (#33754)
21+
* Fix OCI image.version annotation for releases to use full semver (#33698) (#33701)
22+
* Try to fix ACME path when renew (#33668) (#33693)
23+
* Fix mCaptcha bug (#33659) (#33661)
24+
* Git graph: don't show detached commits (#33645) (#33650)
25+
* Use MatchPhraseQuery for bleve code search (#33628)
26+
* Adjust appearence of commit status webhook (#33778) #33789
27+
* Upgrade golang net from 0.35.0 -> 0.36.0 (#33795) #33796
28+
729
## [1.23.4](https://github.com/go-gitea/gitea/releases/tag/v1.23.4) - 2025-02-16
830

931
* SECURITY

options/locale/locale_ga-IE.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,7 @@ pulls.outdated_with_base_branch=Tá an brainse seo as dáta leis an mbunbhrainse
19371937
pulls.close=Dún Iarratas Tarraing
19381938
pulls.closed_at=`dhún an t-iarratas tarraingthe seo <a id="%[1]s" href="#%[1]s">%[2]s</a>`
19391939
pulls.reopened_at=`athoscail an t-iarratas tarraingthe seo <a id="%[1]s" href="#%[1]s">%[2]s</a>`
1940+
pulls.cmd_instruction_hint=Féach ar threoracha na n-orduithe
19401941
pulls.cmd_instruction_checkout_title=Seiceáil
19411942
pulls.cmd_instruction_checkout_desc=Ó stór tionscadail, seiceáil brainse nua agus déan tástáil ar na hathruithe.
19421943
pulls.cmd_instruction_merge_title=Cumaisc

routers/api/v1/repo/branch.go

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,6 @@ func CreateBranchProtection(ctx *context.APIContext) {
594594
return
595595
}
596596

597-
isPlainRule := !git_model.IsRuleNameSpecial(ruleName)
598-
var isBranchExist bool
599-
if isPlainRule {
600-
isBranchExist = git.IsBranchExist(ctx.Req.Context(), ctx.Repo.Repository.RepoPath(), ruleName)
601-
}
602-
603597
protectBranch, err := git_model.GetProtectedBranchRuleByName(ctx, repo.ID, ruleName)
604598
if err != nil {
605599
ctx.APIErrorInternal(err)
@@ -716,7 +710,7 @@ func CreateBranchProtection(ctx *context.APIContext) {
716710
BlockAdminMergeOverride: form.BlockAdminMergeOverride,
717711
}
718712

719-
if err := git_model.UpdateProtectBranch(ctx, ctx.Repo.Repository, protectBranch, git_model.WhitelistOptions{
713+
if err := pull_service.CreateOrUpdateProtectedBranch(ctx, ctx.Repo.Repository, protectBranch, git_model.WhitelistOptions{
720714
UserIDs: whitelistUsers,
721715
TeamIDs: whitelistTeams,
722716
ForcePushUserIDs: forcePushAllowlistUsers,
@@ -730,36 +724,6 @@ func CreateBranchProtection(ctx *context.APIContext) {
730724
return
731725
}
732726

733-
if isBranchExist {
734-
if err := pull_service.CheckPRsForBaseBranch(ctx, ctx.Repo.Repository, ruleName); err != nil {
735-
ctx.APIErrorInternal(err)
736-
return
737-
}
738-
} else {
739-
if !isPlainRule {
740-
if ctx.Repo.GitRepo == nil {
741-
ctx.Repo.GitRepo, err = gitrepo.RepositoryFromRequestContextOrOpen(ctx, ctx.Repo.Repository)
742-
if err != nil {
743-
ctx.APIErrorInternal(err)
744-
return
745-
}
746-
}
747-
// FIXME: since we only need to recheck files protected rules, we could improve this
748-
matchedBranches, err := git_model.FindAllMatchedBranches(ctx, ctx.Repo.Repository.ID, ruleName)
749-
if err != nil {
750-
ctx.APIErrorInternal(err)
751-
return
752-
}
753-
754-
for _, branchName := range matchedBranches {
755-
if err = pull_service.CheckPRsForBaseBranch(ctx, ctx.Repo.Repository, branchName); err != nil {
756-
ctx.APIErrorInternal(err)
757-
return
758-
}
759-
}
760-
}
761-
}
762-
763727
// Reload from db to get all whitelists
764728
bp, err := git_model.GetProtectedBranchRuleByName(ctx, ctx.Repo.Repository.ID, ruleName)
765729
if err != nil {

routers/web/repo/setting/protected_branch.go

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func SettingsProtectedBranchPost(ctx *context.Context) {
261261
protectBranch.BlockOnOutdatedBranch = f.BlockOnOutdatedBranch
262262
protectBranch.BlockAdminMergeOverride = f.BlockAdminMergeOverride
263263

264-
err = git_model.UpdateProtectBranch(ctx, ctx.Repo.Repository, protectBranch, git_model.WhitelistOptions{
264+
if err = pull_service.CreateOrUpdateProtectedBranch(ctx, ctx.Repo.Repository, protectBranch, git_model.WhitelistOptions{
265265
UserIDs: whitelistUsers,
266266
TeamIDs: whitelistTeams,
267267
ForcePushUserIDs: forcePushAllowlistUsers,
@@ -270,24 +270,10 @@ func SettingsProtectedBranchPost(ctx *context.Context) {
270270
MergeTeamIDs: mergeWhitelistTeams,
271271
ApprovalsUserIDs: approvalsWhitelistUsers,
272272
ApprovalsTeamIDs: approvalsWhitelistTeams,
273-
})
274-
if err != nil {
275-
ctx.ServerError("UpdateProtectBranch", err)
276-
return
277-
}
278-
279-
// FIXME: since we only need to recheck files protected rules, we could improve this
280-
matchedBranches, err := git_model.FindAllMatchedBranches(ctx, ctx.Repo.Repository.ID, protectBranch.RuleName)
281-
if err != nil {
282-
ctx.ServerError("FindAllMatchedBranches", err)
273+
}); err != nil {
274+
ctx.ServerError("CreateOrUpdateProtectedBranch", err)
283275
return
284276
}
285-
for _, branchName := range matchedBranches {
286-
if err = pull_service.CheckPRsForBaseBranch(ctx, ctx.Repo.Repository, branchName); err != nil {
287-
ctx.ServerError("CheckPRsForBaseBranch", err)
288-
return
289-
}
290-
}
291277

292278
ctx.Flash.Success(ctx.Tr("repo.settings.update_protect_branch_success", protectBranch.RuleName))
293279
ctx.Redirect(fmt.Sprintf("%s/settings/branches?rule_name=%s", ctx.Repo.RepoLink, protectBranch.RuleName))

services/forms/repo_form.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,6 @@ func (f *RepoSettingForm) Validate(req *http.Request, errs binding.Errors) bindi
170170
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
171171
}
172172

173-
// __________ .__
174-
// \______ \____________ ____ ____ | |__
175-
// | | _/\_ __ \__ \ / \_/ ___\| | \
176-
// | | \ | | \// __ \| | \ \___| Y \
177-
// |______ / |__| (____ /___| /\___ >___| /
178-
// \/ \/ \/ \/ \/
179-
180173
// ProtectBranchForm form for changing protected branch settings
181174
type ProtectBranchForm struct {
182175
RuleName string `binding:"Required"`

services/mailer/mail_comment.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ func MailParticipantsComment(ctx context.Context, c *issues_model.Comment, opTyp
2525
if c.Type == issues_model.CommentTypePullRequestPush {
2626
content = ""
2727
}
28-
if err := mailIssueCommentToParticipants(
29-
&mailCommentContext{
30-
Context: ctx,
28+
if err := mailIssueCommentToParticipants(ctx,
29+
&mailComment{
3130
Issue: issue,
3231
Doer: c.Poster,
3332
ActionType: opType,
@@ -48,9 +47,8 @@ func MailMentionsComment(ctx context.Context, pr *issues_model.PullRequest, c *i
4847

4948
visited := make(container.Set[int64], len(mentions)+1)
5049
visited.Add(c.Poster.ID)
51-
if err = mailIssueCommentBatch(
52-
&mailCommentContext{
53-
Context: ctx,
50+
if err = mailIssueCommentBatch(ctx,
51+
&mailComment{
5452
Issue: pr.Issue,
5553
Doer: c.Poster,
5654
ActionType: activities_model.ActionCommentPull,

services/mailer/mail_issue.go

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,88 +24,88 @@ const MailBatchSize = 100 // batch size used in mailIssueCommentBatch
2424
// This function sends two list of emails:
2525
// 1. Repository watchers (except for WIP pull requests) and users who are participated in comments.
2626
// 2. Users who are not in 1. but get mentioned in current issue/comment.
27-
func mailIssueCommentToParticipants(ctx *mailCommentContext, mentions []*user_model.User) error {
27+
func mailIssueCommentToParticipants(ctx context.Context, comment *mailComment, mentions []*user_model.User) error {
2828
// Required by the mail composer; make sure to load these before calling the async function
29-
if err := ctx.Issue.LoadRepo(ctx); err != nil {
29+
if err := comment.Issue.LoadRepo(ctx); err != nil {
3030
return fmt.Errorf("LoadRepo: %w", err)
3131
}
32-
if err := ctx.Issue.LoadPoster(ctx); err != nil {
32+
if err := comment.Issue.LoadPoster(ctx); err != nil {
3333
return fmt.Errorf("LoadPoster: %w", err)
3434
}
35-
if err := ctx.Issue.LoadPullRequest(ctx); err != nil {
35+
if err := comment.Issue.LoadPullRequest(ctx); err != nil {
3636
return fmt.Errorf("LoadPullRequest: %w", err)
3737
}
3838

3939
// Enough room to avoid reallocations
4040
unfiltered := make([]int64, 1, 64)
4141

4242
// =========== Original poster ===========
43-
unfiltered[0] = ctx.Issue.PosterID
43+
unfiltered[0] = comment.Issue.PosterID
4444

4545
// =========== Assignees ===========
46-
ids, err := issues_model.GetAssigneeIDsByIssue(ctx, ctx.Issue.ID)
46+
ids, err := issues_model.GetAssigneeIDsByIssue(ctx, comment.Issue.ID)
4747
if err != nil {
48-
return fmt.Errorf("GetAssigneeIDsByIssue(%d): %w", ctx.Issue.ID, err)
48+
return fmt.Errorf("GetAssigneeIDsByIssue(%d): %w", comment.Issue.ID, err)
4949
}
5050
unfiltered = append(unfiltered, ids...)
5151

5252
// =========== Participants (i.e. commenters, reviewers) ===========
53-
ids, err = issues_model.GetParticipantsIDsByIssueID(ctx, ctx.Issue.ID)
53+
ids, err = issues_model.GetParticipantsIDsByIssueID(ctx, comment.Issue.ID)
5454
if err != nil {
55-
return fmt.Errorf("GetParticipantsIDsByIssueID(%d): %w", ctx.Issue.ID, err)
55+
return fmt.Errorf("GetParticipantsIDsByIssueID(%d): %w", comment.Issue.ID, err)
5656
}
5757
unfiltered = append(unfiltered, ids...)
5858

5959
// =========== Issue watchers ===========
60-
ids, err = issues_model.GetIssueWatchersIDs(ctx, ctx.Issue.ID, true)
60+
ids, err = issues_model.GetIssueWatchersIDs(ctx, comment.Issue.ID, true)
6161
if err != nil {
62-
return fmt.Errorf("GetIssueWatchersIDs(%d): %w", ctx.Issue.ID, err)
62+
return fmt.Errorf("GetIssueWatchersIDs(%d): %w", comment.Issue.ID, err)
6363
}
6464
unfiltered = append(unfiltered, ids...)
6565

6666
// =========== Repo watchers ===========
6767
// Make repo watchers last, since it's likely the list with the most users
68-
if !(ctx.Issue.IsPull && ctx.Issue.PullRequest.IsWorkInProgress(ctx) && ctx.ActionType != activities_model.ActionCreatePullRequest) {
69-
ids, err = repo_model.GetRepoWatchersIDs(ctx, ctx.Issue.RepoID)
68+
if !(comment.Issue.IsPull && comment.Issue.PullRequest.IsWorkInProgress(ctx) && comment.ActionType != activities_model.ActionCreatePullRequest) {
69+
ids, err = repo_model.GetRepoWatchersIDs(ctx, comment.Issue.RepoID)
7070
if err != nil {
71-
return fmt.Errorf("GetRepoWatchersIDs(%d): %w", ctx.Issue.RepoID, err)
71+
return fmt.Errorf("GetRepoWatchersIDs(%d): %w", comment.Issue.RepoID, err)
7272
}
7373
unfiltered = append(ids, unfiltered...)
7474
}
7575

7676
visited := make(container.Set[int64], len(unfiltered)+len(mentions)+1)
7777

7878
// Avoid mailing the doer
79-
if ctx.Doer.EmailNotificationsPreference != user_model.EmailNotificationsAndYourOwn && !ctx.ForceDoerNotification {
80-
visited.Add(ctx.Doer.ID)
79+
if comment.Doer.EmailNotificationsPreference != user_model.EmailNotificationsAndYourOwn && !comment.ForceDoerNotification {
80+
visited.Add(comment.Doer.ID)
8181
}
8282

8383
// =========== Mentions ===========
84-
if err = mailIssueCommentBatch(ctx, mentions, visited, true); err != nil {
84+
if err = mailIssueCommentBatch(ctx, comment, mentions, visited, true); err != nil {
8585
return fmt.Errorf("mailIssueCommentBatch() mentions: %w", err)
8686
}
8787

8888
// Avoid mailing explicit unwatched
89-
ids, err = issues_model.GetIssueWatchersIDs(ctx, ctx.Issue.ID, false)
89+
ids, err = issues_model.GetIssueWatchersIDs(ctx, comment.Issue.ID, false)
9090
if err != nil {
91-
return fmt.Errorf("GetIssueWatchersIDs(%d): %w", ctx.Issue.ID, err)
91+
return fmt.Errorf("GetIssueWatchersIDs(%d): %w", comment.Issue.ID, err)
9292
}
9393
visited.AddMultiple(ids...)
9494

9595
unfilteredUsers, err := user_model.GetMailableUsersByIDs(ctx, unfiltered, false)
9696
if err != nil {
9797
return err
9898
}
99-
if err = mailIssueCommentBatch(ctx, unfilteredUsers, visited, false); err != nil {
99+
if err = mailIssueCommentBatch(ctx, comment, unfilteredUsers, visited, false); err != nil {
100100
return fmt.Errorf("mailIssueCommentBatch(): %w", err)
101101
}
102102

103103
return nil
104104
}
105105

106-
func mailIssueCommentBatch(ctx *mailCommentContext, users []*user_model.User, visited container.Set[int64], fromMention bool) error {
106+
func mailIssueCommentBatch(ctx context.Context, comment *mailComment, users []*user_model.User, visited container.Set[int64], fromMention bool) error {
107107
checkUnit := unit.TypeIssues
108-
if ctx.Issue.IsPull {
108+
if comment.Issue.IsPull {
109109
checkUnit = unit.TypePullRequests
110110
}
111111

@@ -129,7 +129,7 @@ func mailIssueCommentBatch(ctx *mailCommentContext, users []*user_model.User, vi
129129
}
130130

131131
// test if this user is allowed to see the issue/pull
132-
if !access_model.CheckRepoUnitUser(ctx, ctx.Issue.Repo, user, checkUnit) {
132+
if !access_model.CheckRepoUnitUser(ctx, comment.Issue.Repo, user, checkUnit) {
133133
continue
134134
}
135135

@@ -141,7 +141,7 @@ func mailIssueCommentBatch(ctx *mailCommentContext, users []*user_model.User, vi
141141
// working backwards from the last (possibly) incomplete batch. If len(receivers) can be 0 this
142142
// starting condition will need to be changed slightly
143143
for i := ((len(receivers) - 1) / MailBatchSize) * MailBatchSize; i >= 0; i -= MailBatchSize {
144-
msgs, err := composeIssueCommentMessages(ctx, lang, receivers[i:], fromMention, "issue comments")
144+
msgs, err := composeIssueCommentMessages(ctx, comment, lang, receivers[i:], fromMention, "issue comments")
145145
if err != nil {
146146
return err
147147
}
@@ -168,9 +168,8 @@ func MailParticipants(ctx context.Context, issue *issues_model.Issue, doer *user
168168
content = ""
169169
}
170170
forceDoerNotification := opType == activities_model.ActionAutoMergePullRequest
171-
if err := mailIssueCommentToParticipants(
172-
&mailCommentContext{
173-
Context: ctx,
171+
if err := mailIssueCommentToParticipants(ctx,
172+
&mailComment{
174173
Issue: issue,
175174
Doer: doer,
176175
ActionType: opType,
@@ -205,8 +204,7 @@ func SendIssueAssignedMail(ctx context.Context, issue *issues_model.Issue, doer
205204
}
206205

207206
for lang, tos := range langMap {
208-
msgs, err := composeIssueCommentMessages(&mailCommentContext{
209-
Context: ctx,
207+
msgs, err := composeIssueCommentMessages(ctx, &mailComment{
210208
Issue: issue,
211209
Doer: doer,
212210
ActionType: activities_model.ActionType(0),

0 commit comments

Comments
 (0)