Skip to content

Commit 79f4e01

Browse files
authored
Merge branch 'main' into feature/project-board-api
2 parents 044aac9 + b671d50 commit 79f4e01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2291
-1441
lines changed

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ linters:
111111
- require-error
112112
usetesting:
113113
os-temp-dir: true
114-
modernize:
115-
disable:
116-
- stringsbuilder
117114
perfsprint:
118115
concat-loop: false
119116
govet:

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22
# Build stage
3-
FROM docker.io/library/golang:1.25-alpine3.22 AS build-env
3+
FROM docker.io/library/golang:1.25-alpine3.23 AS build-env
44

55
ARG GOPROXY=direct
66

@@ -39,7 +39,7 @@ RUN chmod 755 /tmp/local/usr/bin/entrypoint \
3939
/tmp/local/etc/s6/.s6-svscan/* \
4040
/go/src/code.gitea.io/gitea/gitea
4141

42-
FROM docker.io/library/alpine:3.22 AS gitea
42+
FROM docker.io/library/alpine:3.23 AS gitea
4343

4444
EXPOSE 22 3000
4545

Dockerfile.rootless

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22
# Build stage
3-
FROM docker.io/library/golang:1.25-alpine3.22 AS build-env
3+
FROM docker.io/library/golang:1.25-alpine3.23 AS build-env
44

55
ARG GOPROXY=direct
66

@@ -33,7 +33,7 @@ COPY docker/rootless /tmp/local
3333
RUN chmod 755 /tmp/local/usr/local/bin/* \
3434
/go/src/code.gitea.io/gitea/gitea
3535

36-
FROM docker.io/library/alpine:3.22 AS gitea-rootless
36+
FROM docker.io/library/alpine:3.23 AS gitea-rootless
3737

3838
EXPOSE 2222 3000
3939

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ XGO_VERSION := go-1.25.x
3232
AIR_PACKAGE ?= github.com/air-verse/air@v1
3333
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
3434
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
35-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/[email protected].0
35+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/[email protected].2
3636
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3737
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected]
3838
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]
@@ -339,12 +339,12 @@ lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backen
339339

340340
.PHONY: lint-js
341341
lint-js: node_modules ## lint js files
342-
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --flag unstable_native_nodejs_ts_config $(ESLINT_FILES)
342+
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 $(ESLINT_FILES)
343343
$(NODE_VARS) pnpm exec vue-tsc
344344

345345
.PHONY: lint-js-fix
346346
lint-js-fix: node_modules ## lint js files and fix issues
347-
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --flag unstable_native_nodejs_ts_config $(ESLINT_FILES) --fix
347+
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 $(ESLINT_FILES) --fix
348348
$(NODE_VARS) pnpm exec vue-tsc
349349

350350
.PHONY: lint-css

custom/conf/app.example.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,9 @@ LEVEL = Info
733733
;DISABLE_CORE_PROTECT_NTFS=false
734734
;; Disable the usage of using partial clones for git.
735735
;DISABLE_PARTIAL_CLONE = false
736+
;; Set the similarity threshold passed to git commands via `--find-renames=<threshold>`.
737+
;; Default is 50%, the same as git. Must be a integer percentage between 0% and 100%.
738+
;DIFF_RENAME_SIMILARITY_THRESHOLD = 50%
736739

737740
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
738741
;; Git Operation timeout in seconds

eslint.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export default defineConfig([
215215
'@typescript-eslint/no-unnecessary-condition': [0],
216216
'@typescript-eslint/no-unnecessary-qualifier': [0],
217217
'@typescript-eslint/no-unnecessary-template-expression': [0],
218-
'@typescript-eslint/no-unnecessary-type-arguments': [0],
218+
'@typescript-eslint/no-unnecessary-type-arguments': [2],
219219
'@typescript-eslint/no-unnecessary-type-assertion': [2],
220220
'@typescript-eslint/no-unnecessary-type-constraint': [2],
221221
'@typescript-eslint/no-unnecessary-type-conversion': [2],
@@ -228,11 +228,12 @@ export default defineConfig([
228228
'@typescript-eslint/no-unsafe-member-access': [0],
229229
'@typescript-eslint/no-unsafe-return': [0],
230230
'@typescript-eslint/no-unsafe-unary-minus': [2],
231-
'@typescript-eslint/no-unused-expressions': [0],
231+
'@typescript-eslint/no-unused-expressions': [2],
232232
'@typescript-eslint/no-unused-private-class-members': [2],
233233
'@typescript-eslint/no-unused-vars': [2, {vars: 'all', args: 'all', caughtErrors: 'all', ignoreRestSiblings: false, argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_'}],
234234
'@typescript-eslint/no-use-before-define': [2, {functions: false, classes: true, variables: true, allowNamedExports: true, typedefs: false, enums: false, ignoreTypeReferences: true}],
235235
'@typescript-eslint/no-useless-constructor': [0],
236+
'@typescript-eslint/no-useless-default-assignment': [0], // https://github.com/typescript-eslint/typescript-eslint/issues/11847
236237
'@typescript-eslint/no-useless-empty-export': [0],
237238
'@typescript-eslint/no-wrapper-object-types': [2],
238239
'@typescript-eslint/non-nullable-type-assertion-style': [0],
@@ -584,7 +585,7 @@ export default defineConfig([
584585
'no-unreachable': [2],
585586
'no-unsafe-finally': [2],
586587
'no-unsafe-negation': [2],
587-
'no-unused-expressions': [2],
588+
'no-unused-expressions': [0], // handled by @typescript-eslint/no-unused-expressions
588589
'no-unused-labels': [2],
589590
'no-unused-private-class-members': [0], // handled by @typescript-eslint/no-unused-private-class-members
590591
'no-unused-vars': [0], // handled by @typescript-eslint/no-unused-vars

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
github.com/ProtonMail/go-crypto v1.3.0
2929
github.com/PuerkitoBio/goquery v1.10.3
3030
github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.8.0
31-
github.com/alecthomas/chroma/v2 v2.20.0
31+
github.com/alecthomas/chroma/v2 v2.21.0
3232
github.com/aws/aws-sdk-go-v2/credentials v1.18.10
3333
github.com/aws/aws-sdk-go-v2/service/codecommit v1.32.2
3434
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.8.0/go.mod h1:1HmmMEVsr+0R
9898
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
9999
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
100100
github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs=
101-
github.com/alecthomas/chroma/v2 v2.20.0 h1:sfIHpxPyR07/Oylvmcai3X/exDlE8+FA820NTz+9sGw=
102-
github.com/alecthomas/chroma/v2 v2.20.0/go.mod h1:e7tViK0xh/Nf4BYHl00ycY6rV7b8iXBksI9E359yNmA=
101+
github.com/alecthomas/chroma/v2 v2.21.0 h1:YVW9qQAFnQm2OFPPFQg6G/TpMxKSsUr/KUPDi/BEqtY=
102+
github.com/alecthomas/chroma/v2 v2.21.0/go.mod h1:NqVhfBR0lte5Ouh3DcthuUCTUpDC9cxBOfyMbMQPs3o=
103103
github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
104-
github.com/alecthomas/repr v0.5.1 h1:E3G4t2QbHTSNpPKBgMTln5KLkZHLOcU7r37J4pXBuIg=
105-
github.com/alecthomas/repr v0.5.1/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
104+
github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs=
105+
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
106106
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa h1:LHTHcTQiSGT7VVbI0o4wBRNQIgn917usHWOd6VAffYI=
107107
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
108108
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=

models/issues/pull_list.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
user_model "code.gitea.io/gitea/models/user"
1515
"code.gitea.io/gitea/modules/container"
1616
"code.gitea.io/gitea/modules/log"
17+
"code.gitea.io/gitea/modules/timeutil"
1718
"code.gitea.io/gitea/modules/util"
1819

1920
"xorm.io/builder"
@@ -324,12 +325,26 @@ func (prs PullRequestList) LoadReviews(ctx context.Context) (ReviewList, error)
324325

325326
// HasMergedPullRequestInRepo returns whether the user(poster) has merged pull-request in the repo
326327
func HasMergedPullRequestInRepo(ctx context.Context, repoID, posterID int64) (bool, error) {
327-
return db.GetEngine(ctx).
328+
return HasMergedPullRequestInRepoBefore(ctx, repoID, posterID, 0, 0)
329+
}
330+
331+
// HasMergedPullRequestInRepoBefore returns whether the user has a merged PR before a timestamp (0 = no limit)
332+
func HasMergedPullRequestInRepoBefore(ctx context.Context, repoID, posterID int64, beforeUnix timeutil.TimeStamp, excludePullID int64) (bool, error) {
333+
sess := db.GetEngine(ctx).
328334
Join("INNER", "pull_request", "pull_request.issue_id = issue.id").
329335
Where("repo_id=?", repoID).
330336
And("poster_id=?", posterID).
331337
And("is_pull=?", true).
332-
And("pull_request.has_merged=?", true).
338+
And("pull_request.has_merged=?", true)
339+
340+
if beforeUnix > 0 {
341+
sess.And("pull_request.merged_unix < ?", beforeUnix)
342+
}
343+
if excludePullID > 0 {
344+
sess.And("pull_request.id != ?", excludePullID)
345+
}
346+
347+
return sess.
333348
Select("issue.id").
334349
Limit(1).
335350
Get(new(Issue))

models/perm/access/repo_permission.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"errors"
99
"fmt"
1010
"slices"
11+
"strings"
1112

1213
actions_model "code.gitea.io/gitea/models/actions"
1314
"code.gitea.io/gitea/models/db"
@@ -169,7 +170,8 @@ func (p *Permission) ReadableUnitTypes() []unit.Type {
169170
}
170171

171172
func (p *Permission) LogString() string {
172-
format := "<Permission AccessMode=%s, %d Units, %d UnitsMode(s): ["
173+
var format strings.Builder
174+
format.WriteString("<Permission AccessMode=%s, %d Units, %d UnitsMode(s): [")
173175
args := []any{p.AccessMode.ToString(), len(p.units), len(p.unitsMode)}
174176

175177
for i, u := range p.units {
@@ -181,19 +183,19 @@ func (p *Permission) LogString() string {
181183
config = err.Error()
182184
}
183185
}
184-
format += "\n\tunits[%d]: ID=%d RepoID=%d Type=%s Config=%s"
186+
format.WriteString("\n\tunits[%d]: ID=%d RepoID=%d Type=%s Config=%s")
185187
args = append(args, i, u.ID, u.RepoID, u.Type.LogString(), config)
186188
}
187189
for key, value := range p.unitsMode {
188-
format += "\n\tunitsMode[%-v]: %-v"
190+
format.WriteString("\n\tunitsMode[%-v]: %-v")
189191
args = append(args, key.LogString(), value.LogString())
190192
}
191-
format += "\n\tanonymousAccessMode: %-v"
193+
format.WriteString("\n\tanonymousAccessMode: %-v")
192194
args = append(args, p.anonymousAccessMode)
193-
format += "\n\teveryoneAccessMode: %-v"
195+
format.WriteString("\n\teveryoneAccessMode: %-v")
194196
args = append(args, p.everyoneAccessMode)
195-
format += "\n\t]>"
196-
return fmt.Sprintf(format, args...)
197+
format.WriteString("\n\t]>")
198+
return fmt.Sprintf(format.String(), args...)
197199
}
198200

199201
func applyPublicAccessPermission(unitType unit.Type, accessMode perm_model.AccessMode, modeMap *map[unit.Type]perm_model.AccessMode) {

0 commit comments

Comments
 (0)