Skip to content

Commit 43e0beb

Browse files
authored
Merge branch 'main' into lunny/fix_migrate_issue_bug
2 parents b07e98a + 98ef79d commit 43e0beb

File tree

221 files changed

+2868
-2554
lines changed

Some content is hidden

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

221 files changed

+2868
-2554
lines changed

.air.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tmp_dir = ".air"
44
[build]
55
pre_cmd = ["killall -9 gitea 2>/dev/null || true"] # kill off potential zombie processes from previous runs
66
cmd = "make --no-print-directory backend"
7-
bin = "gitea"
7+
entrypoint = ["./gitea"]
88
delay = 2000
99
include_ext = ["go", "tmpl"]
1010
include_file = ["main.go"]

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ linters:
114114
- stringsbuilder
115115
perfsprint:
116116
concat-loop: false
117+
govet:
118+
enable:
119+
- nilness
120+
- unusedwrite
117121
exclusions:
118122
generated: lax
119123
presets:

Makefile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,14 @@ 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/golangci-lint@v2.6.0
35+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.7.0
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]
3939
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
4040
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1
4141
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1
4242
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/[email protected]
43-
GOPLS_PACKAGE ?= golang.org/x/tools/[email protected]
4443

4544
DOCKER_IMAGE ?= gitea/gitea
4645
DOCKER_TAG ?= latest
@@ -333,7 +332,7 @@ lint-frontend: lint-js lint-css ## lint frontend files
333332
lint-frontend-fix: lint-js-fix lint-css-fix ## lint frontend files and fix issues
334333

335334
.PHONY: lint-backend
336-
lint-backend: lint-go lint-go-gitea-vet lint-go-gopls lint-editorconfig ## lint backend files
335+
lint-backend: lint-go lint-go-gitea-vet lint-editorconfig ## lint backend files
337336

338337
.PHONY: lint-backend-fix
339338
lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backend files and fix issues
@@ -396,11 +395,6 @@ lint-go-gitea-vet: ## lint go files with gitea-vet
396395
@echo "Running gitea-vet..."
397396
@$(GO) vet -vettool="$(shell GOOS= GOARCH= go tool -n gitea-vet)" ./...
398397

399-
.PHONY: lint-go-gopls
400-
lint-go-gopls: ## lint go files with gopls
401-
@echo "Running gopls check..."
402-
@GO=$(GO) GOPLS_PACKAGE=$(GOPLS_PACKAGE) tools/lint-go-gopls.sh $(GO_SOURCES)
403-
404398
.PHONY: lint-editorconfig
405399
lint-editorconfig:
406400
@echo "Running editorconfig check..."
@@ -844,7 +838,6 @@ deps-tools: ## install tool dependencies
844838
$(GO) install $(GO_LICENSES_PACKAGE) & \
845839
$(GO) install $(GOVULNCHECK_PACKAGE) & \
846840
$(GO) install $(ACTIONLINT_PACKAGE) & \
847-
$(GO) install $(GOPLS_PACKAGE) & \
848841
wait
849842

850843
node_modules: pnpm-lock.yaml

eslint.config.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import comments from '@eslint-community/eslint-plugin-eslint-comments';
33
import github from 'eslint-plugin-github';
44
import globals from 'globals';
55
import importPlugin from 'eslint-plugin-import-x';
6-
import noUseExtendNative from 'eslint-plugin-no-use-extend-native';
76
import playwright from 'eslint-plugin-playwright';
87
import regexp from 'eslint-plugin-regexp';
98
import sonarjs from 'eslint-plugin-sonarjs';
@@ -58,7 +57,6 @@ export default defineConfig([
5857
'array-func': arrayFunc,
5958
// @ts-expect-error -- https://github.com/un-ts/eslint-plugin-import-x/issues/203
6059
'import-x': importPlugin,
61-
'no-use-extend-native': noUseExtendNative,
6260
regexp,
6361
sonarjs,
6462
unicorn,
@@ -155,7 +153,7 @@ export default defineConfig([
155153
'@typescript-eslint/ban-tslint-comment': [0],
156154
'@typescript-eslint/class-literal-property-style': [0],
157155
'@typescript-eslint/class-methods-use-this': [0],
158-
'@typescript-eslint/consistent-generic-constructors': [0],
156+
'@typescript-eslint/consistent-generic-constructors': [2, 'constructor'],
159157
'@typescript-eslint/consistent-indexed-object-style': [0],
160158
'@typescript-eslint/consistent-return': [0],
161159
'@typescript-eslint/consistent-type-assertions': [2, {assertionStyle: 'as', objectLiteralTypeAssertions: 'allow'}],
@@ -231,6 +229,7 @@ export default defineConfig([
231229
'@typescript-eslint/no-unsafe-return': [0],
232230
'@typescript-eslint/no-unsafe-unary-minus': [2],
233231
'@typescript-eslint/no-unused-expressions': [0],
232+
'@typescript-eslint/no-unused-private-class-members': [2],
234233
'@typescript-eslint/no-unused-vars': [2, {vars: 'all', args: 'all', caughtErrors: 'all', ignoreRestSiblings: false, argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_'}],
235234
'@typescript-eslint/no-use-before-define': [2, {functions: false, classes: true, variables: true, allowNamedExports: true, typedefs: false, enums: false, ignoreTypeReferences: true}],
236235
'@typescript-eslint/no-useless-constructor': [0],
@@ -587,10 +586,9 @@ export default defineConfig([
587586
'no-unsafe-negation': [2],
588587
'no-unused-expressions': [2],
589588
'no-unused-labels': [2],
590-
'no-unused-private-class-members': [2],
589+
'no-unused-private-class-members': [0], // handled by @typescript-eslint/no-unused-private-class-members
591590
'no-unused-vars': [0], // handled by @typescript-eslint/no-unused-vars
592591
'no-use-before-define': [0], // handled by @typescript-eslint/no-use-before-define
593-
'no-use-extend-native/no-use-extend-native': [2],
594592
'no-useless-assignment': [2],
595593
'no-useless-backreference': [2],
596594
'no-useless-call': [2],

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module code.gitea.io/gitea
22

33
go 1.25.0
44

5-
toolchain go1.25.4
5+
toolchain go1.25.5
66

77
// rfc5280 said: "The serial number is an integer assigned by the CA to each certificate."
88
// But some CAs use negative serial number, just relax the check. related:

models/perm/access/repo_permission.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,14 @@ func GetActionsUserRepoPermission(ctx context.Context, repo *repo_model.Reposito
276276
if !actionsCfg.IsCollaborativeOwner(taskRepo.OwnerID) || !taskRepo.IsPrivate {
277277
// The task repo can access the current repo only if the task repo is private and
278278
// the owner of the task repo is a collaborative owner of the current repo.
279-
// FIXME allow public repo read access if tokenless pull is enabled
280279
// FIXME should owner's visibility also be considered here?
280+
281+
// check permission like simple user but limit to read-only
282+
perm, err = GetUserRepoPermission(ctx, repo, user_model.NewActionsUser())
283+
if err != nil {
284+
return perm, err
285+
}
286+
perm.AccessMode = min(perm.AccessMode, perm_model.AccessModeRead)
281287
return perm, nil
282288
}
283289
accessMode = perm_model.AccessModeRead

models/pull/review_state.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ func GetReviewState(ctx context.Context, userID, pullID int64, commitSHA string)
7373

7474
// UpdateReviewState updates the given review inside the database, regardless of whether it existed before or not
7575
// The given map of files with their viewed state will be merged with the previous review, if present
76-
func UpdateReviewState(ctx context.Context, userID, pullID int64, commitSHA string, updatedFiles map[string]ViewedState) error {
76+
func UpdateReviewState(ctx context.Context, userID, pullID int64, commitSHA string, updatedFiles map[string]ViewedState) (*ReviewState, error) {
7777
log.Trace("Updating review for user %d, repo %d, commit %s with the updated files %v.", userID, pullID, commitSHA, updatedFiles)
7878

7979
review, exists, err := GetReviewState(ctx, userID, pullID, commitSHA)
8080
if err != nil {
81-
return err
81+
return nil, err
8282
}
8383

8484
if exists {
8585
review.UpdatedFiles = mergeFiles(review.UpdatedFiles, updatedFiles)
8686
} else if previousReview, err := getNewestReviewStateApartFrom(ctx, userID, pullID, commitSHA); err != nil {
87-
return err
87+
return nil, err
8888

8989
// Overwrite the viewed files of the previous review if present
9090
} else if previousReview != nil {
@@ -98,11 +98,11 @@ func UpdateReviewState(ctx context.Context, userID, pullID int64, commitSHA stri
9898
if !exists {
9999
log.Trace("Inserting new review for user %d, repo %d, commit %s with the updated files %v.", userID, pullID, commitSHA, review.UpdatedFiles)
100100
_, err := engine.Insert(review)
101-
return err
101+
return nil, err
102102
}
103103
log.Trace("Updating already existing review with ID %d (user %d, repo %d, commit %s) with the updated files %v.", review.ID, userID, pullID, commitSHA, review.UpdatedFiles)
104-
_, err = engine.ID(review.ID).Update(&ReviewState{UpdatedFiles: review.UpdatedFiles})
105-
return err
104+
_, err = engine.ID(review.ID).Cols("updated_files").Update(review)
105+
return review, err
106106
}
107107

108108
// mergeFiles merges the given maps of files with their viewing state into one map.

modules/fileicon/material.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (m *MaterialIconProvider) renderFileIconSVG(p *RenderedIconPool, name, svg,
7676
if p.IconSVGs[svgID] == "" {
7777
p.IconSVGs[svgID] = svgHTML
7878
}
79-
return template.HTML(`<svg ` + svgCommonAttrs + `><use xlink:href="#` + svgID + `"></use></svg>`)
79+
return template.HTML(`<svg ` + svgCommonAttrs + `><use href="#` + svgID + `"></use></svg>`)
8080
}
8181

8282
func (m *MaterialIconProvider) EntryIconHTML(p *RenderedIconPool, entry *EntryInfo) template.HTML {

modules/fileicon/render.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (p *RenderedIconPool) RenderToHTML() template.HTML {
2525
return ""
2626
}
2727
sb := &strings.Builder{}
28-
sb.WriteString(`<div class=tw-hidden>`)
28+
sb.WriteString(`<div class="svg-icon-container">`)
2929
for _, icon := range p.IconSVGs {
3030
sb.WriteString(string(icon))
3131
}

modules/git/attribute/attribute.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ func (attrs *Attributes) GetGitlabLanguage() optional.Option[string] {
9696
// gitlab-language may have additional parameters after the language
9797
// ignore them and just use the main language
9898
// https://docs.gitlab.com/ee/user/project/highlighting.html#override-syntax-highlighting-for-a-file-type
99-
if idx := strings.IndexByte(raw, '?'); idx >= 0 {
100-
return optional.Some(raw[:idx])
99+
if before, _, ok := strings.Cut(raw, "?"); ok {
100+
return optional.Some(before)
101101
}
102102
}
103103
return attrStr

0 commit comments

Comments
 (0)