Skip to content

Commit 0b7bce9

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (26 commits) Make HTML template functions support context (go-gitea#24056) Fix issue attachment handling (go-gitea#24202) Update JS dependencies (go-gitea#24218) Remove most path-based golangci exclusions (go-gitea#24214) [skip ci] Updated translations via Crowdin Fix internal sever error when visiting a PR that bound to the deleted team (go-gitea#24127) Add owner team permission check test (go-gitea#24096) Fix incorrect CORS default values (go-gitea#24206) Add repository counter badge to repository tab (go-gitea#24205) Fix template error in pull request with deleted head repo (go-gitea#24192) Make wiki title supports dashes and improve wiki name related features (go-gitea#24143) Fix Resolve Conversation not working in Conversation view (go-gitea#24191) Vertical widths of containers removed (go-gitea#24184) Don't list root repository on compare page if pulls not allowed (go-gitea#24183) Add unset default project column (go-gitea#23531) Allow adding new files to an empty repo (go-gitea#24164) Add runner check in repo action page (go-gitea#24124) Use same action status svg icons on actions list as on action page (go-gitea#24178) [skip ci] Updated translations via Crowdin fix calReleaseNumCommitsBehind (go-gitea#24148) ... # Conflicts: # templates/repo/wiki/view.tmpl
2 parents bab3026 + 722dab5 commit 0b7bce9

File tree

178 files changed

+3460
-3008
lines changed

Some content is hidden

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

178 files changed

+3460
-3008
lines changed

.drone.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,11 @@ steps:
756756

757757
# TODO: We should probably build all dependencies into a test image
758758
- name: test-e2e
759-
image: mcr.microsoft.com/playwright:v1.32.1-focal
759+
image: mcr.microsoft.com/playwright:v1.32.3-focal
760760
commands:
761-
- curl -sLO https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
761+
- apt-get -qq update && apt-get -qqy install jq build-essential
762+
- curl -fsSL "https://go.dev/dl/$(curl -s 'https://go.dev/dl/?mode=json' | jq -r '.[].version' | sort -Vr | head -1).linux-amd64.tar.gz" | tar -xz -C /usr/local
762763
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
763-
- apt-get -qq update && apt-get -qqy install build-essential
764764
- ./build/test-env-prepare.sh
765765
- su gitea bash -c "export PATH=$PATH:/usr/local/go/bin && timeout -s ABRT 40m make test-e2e-sqlite"
766766
environment:

.eslintrc.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ rules:
6565
curly: [0]
6666
custom-elements/expose-class-on-global: [0]
6767
custom-elements/extends-correct-class: [2]
68-
custom-elements/file-name-matches-element: [0]
68+
custom-elements/file-name-matches-element: [2]
6969
custom-elements/no-constructor: [2]
7070
custom-elements/no-customized-built-in-elements: [2]
7171
custom-elements/no-dom-traversal-in-attributechangedcallback: [2]
@@ -500,7 +500,7 @@ rules:
500500
unicorn/prefer-default-parameters: [0]
501501
unicorn/prefer-event-key: [2]
502502
unicorn/prefer-event-target: [2]
503-
unicorn/prefer-export-from: [2]
503+
unicorn/prefer-export-from: [2, {ignoreUsedVariables: true}]
504504
unicorn/prefer-includes: [2]
505505
unicorn/prefer-json-parse-buffer: [0]
506506
unicorn/prefer-logical-operator-over-ternary: [2]

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
* text=auto eol=lf
22
*.tmpl linguist-language=Handlebars
33
/assets/*.json linguist-generated
4+
/public/img/svg/*.svg linguist-generated
45
/public/vendor/** -text -eol linguist-vendored
56
/vendor/** -text -eol linguist-vendored
67
/web_src/fomantic/build/** linguist-generated

.golangci.yml

-51
Original file line numberDiff line numberDiff line change
@@ -111,67 +111,16 @@ issues:
111111
- linters:
112112
- gocritic
113113
text: "`ID' should not be capitalized"
114-
- path: modules/templates/helper.go
115-
linters:
116-
- gocritic
117114
- linters:
118115
- unused
119116
- deadcode
120117
text: "swagger"
121-
- path: contrib/pr/checkout.go
122-
linters:
123-
- errcheck
124-
- path: models/issue.go
125-
linters:
126-
- errcheck
127-
- path: models/migrations/
128-
linters:
129-
- errcheck
130-
- path: modules/log/
131-
linters:
132-
- errcheck
133-
- path: routers/api/v1/repo/issue_subscription.go
134-
linters:
135-
- dupl
136-
- path: routers/repo/view.go
137-
linters:
138-
- dupl
139-
- path: models/migrations/
140-
linters:
141-
- unused
142118
- linters:
143119
- staticcheck
144120
text: "argument x is overwritten before first use"
145-
- path: modules/httplib/httplib.go
146-
linters:
147-
- staticcheck
148-
# Enabling this would require refactoring the methods and how they are called.
149-
- path: models/issue_comment_list.go
150-
linters:
151-
- dupl
152-
- path: models/update.go
153-
linters:
154-
- unused
155-
- path: cmd/dump.go
156-
linters:
157-
- dupl
158-
- path: services/webhook/webhook.go
159-
linters:
160-
- structcheck
161121
- text: "commentFormatting: put a space between `//` and comment text"
162122
linters:
163123
- gocritic
164124
- text: "exitAfterDefer:"
165125
linters:
166126
- gocritic
167-
- path: modules/graceful/manager_windows.go
168-
linters:
169-
- staticcheck
170-
text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."
171-
- path: models/user/openid.go
172-
linters:
173-
- golint
174-
- path: models/user/badge.go
175-
linters:
176-
- revive
177-
text: "exported: type name will be used as user.UserBadge by other packages, and that stutters; consider calling this Badge"

models/db/iterate_test.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ func TestIterate(t *testing.T) {
1919
xe := unittest.GetXORMEngine()
2020
assert.NoError(t, xe.Sync(&repo_model.RepoUnit{}))
2121

22-
var repoCnt int
23-
err := db.Iterate(db.DefaultContext, nil, func(ctx context.Context, repo *repo_model.RepoUnit) error {
24-
repoCnt++
22+
cnt, err := db.GetEngine(db.DefaultContext).Count(&repo_model.RepoUnit{})
23+
assert.NoError(t, err)
24+
25+
var repoUnitCnt int
26+
err = db.Iterate(db.DefaultContext, nil, func(ctx context.Context, repo *repo_model.RepoUnit) error {
27+
repoUnitCnt++
2528
return nil
2629
})
2730
assert.NoError(t, err)
28-
assert.EqualValues(t, 84, repoCnt)
31+
assert.EqualValues(t, cnt, repoUnitCnt)
2932

3033
err = db.Iterate(db.DefaultContext, nil, func(ctx context.Context, repoUnit *repo_model.RepoUnit) error {
3134
reopUnit2 := repo_model.RepoUnit{ID: repoUnit.ID}

models/db/list_test.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,20 @@ func TestFind(t *testing.T) {
3131
xe := unittest.GetXORMEngine()
3232
assert.NoError(t, xe.Sync(&repo_model.RepoUnit{}))
3333

34+
var repoUnitCount int
35+
_, err := db.GetEngine(db.DefaultContext).SQL("SELECT COUNT(*) FROM repo_unit").Get(&repoUnitCount)
36+
assert.NoError(t, err)
37+
assert.NotEmpty(t, repoUnitCount)
38+
3439
opts := mockListOptions{}
3540
var repoUnits []repo_model.RepoUnit
36-
err := db.Find(db.DefaultContext, &opts, &repoUnits)
41+
err = db.Find(db.DefaultContext, &opts, &repoUnits)
3742
assert.NoError(t, err)
38-
assert.EqualValues(t, 84, len(repoUnits))
43+
assert.EqualValues(t, repoUnitCount, len(repoUnits))
3944

4045
cnt, err := db.Count(db.DefaultContext, &opts, new(repo_model.RepoUnit))
4146
assert.NoError(t, err)
42-
assert.EqualValues(t, 84, cnt)
47+
assert.EqualValues(t, repoUnitCount, cnt)
4348

4449
repoUnits = make([]repo_model.RepoUnit, 0, 10)
4550
newCnt, err := db.FindAndCount(db.DefaultContext, &opts, &repoUnits)

models/dbfs/dbfs_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import (
1212
"code.gitea.io/gitea/models/db"
1313

1414
"github.com/stretchr/testify/assert"
15-
16-
_ "github.com/mattn/go-sqlite3"
1715
)
1816

1917
func changeDefaultFileBlockSize(n int64) (restore func()) {

models/fixtures/release.yml

+42
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,45 @@
6666
is_prerelease: true
6767
is_tag: false
6868
created_unix: 946684800
69+
70+
- id: 6
71+
repo_id: 57
72+
publisher_id: 2
73+
tag_name: "v1.0"
74+
lower_tag_name: "v1.0"
75+
target: "main"
76+
title: "v1.0"
77+
sha1: "a8a700e8c644c783ba2c6e742bb81bf91e244bff"
78+
num_commits: 3
79+
is_draft: false
80+
is_prerelease: false
81+
is_tag: false
82+
created_unix: 946684801
83+
84+
- id: 7
85+
repo_id: 57
86+
publisher_id: 2
87+
tag_name: "v1.1"
88+
lower_tag_name: "v1.1"
89+
target: "main"
90+
title: "v1.1"
91+
sha1: "cef06e48f2642cd0dc9597b4bea09f4b3f74aad6"
92+
num_commits: 5
93+
is_draft: false
94+
is_prerelease: false
95+
is_tag: false
96+
created_unix: 946684802
97+
98+
- id: 8
99+
repo_id: 57
100+
publisher_id: 2
101+
tag_name: "v2.0"
102+
lower_tag_name: "v2.0"
103+
target: "main"
104+
title: "v2.0"
105+
sha1: "7197b56fdc75b453f47c9110938cb46a303579fd"
106+
num_commits: 6
107+
is_draft: false
108+
is_prerelease: false
109+
is_tag: false
110+
created_unix: 946684803

models/fixtures/repo_unit.yml

+32
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# See models/unit/unit.go for the meaning of the type
12
-
23
id: 1
34
repo_id: 1
@@ -575,3 +576,34 @@
575576
repo_id: 56
576577
type: 1
577578
created_unix: 946684810
579+
-
580+
id: 85
581+
repo_id: 57
582+
type: 1
583+
created_unix: 946684810
584+
-
585+
id: 86
586+
repo_id: 57
587+
type: 2
588+
created_unix: 946684810
589+
-
590+
id: 87
591+
repo_id: 57
592+
type: 3
593+
created_unix: 946684810
594+
-
595+
id: 88
596+
repo_id: 57
597+
type: 4
598+
created_unix: 946684810
599+
-
600+
id: 89
601+
repo_id: 57
602+
type: 5
603+
created_unix: 946684810
604+
605+
-
606+
id: 90
607+
repo_id: 52
608+
type: 1
609+
created_unix: 946684810

models/fixtures/repository.yml

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# don't forget to add fixtures in repo_unit.yml
12
-
23
id: 1
34
owner_id: 2
@@ -1559,6 +1560,7 @@
15591560
owner_name: user30
15601561
lower_name: empty
15611562
name: empty
1563+
default_branch: master
15621564
num_watches: 0
15631565
num_stars: 0
15641566
num_forks: 0
@@ -1647,3 +1649,16 @@
16471649
is_private: true
16481650
status: 0
16491651
num_issues: 0
1652+
1653+
-
1654+
id: 57
1655+
owner_id: 2
1656+
owner_name: user2
1657+
lower_name: repo-release
1658+
name: repo-release
1659+
default_branch: main
1660+
is_empty: false
1661+
is_archived: false
1662+
is_private: false
1663+
status: 0
1664+
num_issues: 0

models/fixtures/user.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
num_followers: 2
6767
num_following: 1
6868
num_stars: 2
69-
num_repos: 12
69+
num_repos: 13
7070
num_teams: 0
7171
num_members: 0
7272
visibility: 0
@@ -1091,7 +1091,7 @@
10911091
max_repo_creation: -1
10921092
is_active: true
10931093
is_admin: false
1094-
is_restricted: true
1094+
is_restricted: false
10951095
allow_git_hook: false
10961096
allow_import_local: false
10971097
allow_create_organization: true

0 commit comments

Comments
 (0)