Skip to content

Commit a680650

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Remove legacy unmaintained packages, refactor to support change default locale (go-gitea#19308) [skip ci] Updated translations via Crowdin Prevent intermittent NPE in queue tests (go-gitea#19301) Upgrade xorm/builder from v0.3.9 to v0.3.10 (go-gitea#19296) An attempt to sync a non-mirror repo must give 400 (Bad Request) (go-gitea#19300) Remove legacy `unknwon/com` package (go-gitea#19298) Improve package registry docs (go-gitea#19273) A pull-mirror repo should be marked as such on creation (go-gitea#19295) Refactor legacy `unknwon/com` package, improve golangci lint (go-gitea#19284) Skip frontend ROOT_URL check on installation page, remove unnecessary global var (go-gitea#19291)
2 parents dd36434 + d242511 commit a680650

Some content is hidden

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

68 files changed

+1709
-188
lines changed

.golangci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ linters:
1818
- ineffassign
1919
- revive
2020
- gofumpt
21+
- depguard
2122
enable-all: false
2223
disable-all: true
2324
fast: false
@@ -65,7 +66,15 @@ linters-settings:
6566
- name: modifies-value-receiver
6667
gofumpt:
6768
extra-rules: true
68-
lang-version: 1.18
69+
lang-version: "1.18"
70+
depguard:
71+
# TODO: use depguard to replace import checks in gitea-vet
72+
list-type: denylist
73+
# Check the list against standard lib.
74+
include-go-root: true
75+
packages-with-error-message:
76+
- encoding/json: "use gitea's modules/json instead of encoding/json"
77+
- github.com/unknwon/com: "use gitea's util and replacements"
6978

7079
issues:
7180
exclude-rules:
@@ -153,5 +162,6 @@ issues:
153162
- path: models/user/openid.go
154163
linters:
155164
- golint
156-
- linters: staticcheck
165+
- linters:
166+
- staticcheck
157167
text: "strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead."

cmd/manager_logging.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"code.gitea.io/gitea/modules/log"
1313
"code.gitea.io/gitea/modules/private"
14+
1415
"github.com/urfave/cli"
1516
)
1617

contrib/pr/checkout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func runPR() {
112112
unittest.LoadFixtures()
113113
util.RemoveAll(setting.RepoRootPath)
114114
util.RemoveAll(models.LocalCopyPath())
115-
util.CopyDir(path.Join(curDir, "integrations/gitea-repositories-meta"), setting.RepoRootPath)
115+
unittest.CopyDir(path.Join(curDir, "integrations/gitea-repositories-meta"), setting.RepoRootPath)
116116

117117
log.Printf("[PR] Setting up router\n")
118118
// routers.GlobalInit()

custom/conf/app.example.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,7 @@ PATH =
21172117
;[i18n]
21182118
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21192119
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2120+
;; The first locale will be used as the default if user browser's language doesn't match any locale in the list.
21202121
;LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN
21212122
;NAMES = English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,Українська,日本語,español,português do Brasil,Português de Portugal,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어,ελληνικά,فارسی,magyar nyelv,bahasa Indonesia,മലയാളം
21222123

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,8 @@ Default templates for project boards:
997997

998998
## i18n (`i18n`)
999999

1000-
- `LANGS`: **en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN**: List of locales shown in language selector
1000+
- `LANGS`: **en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN**:
1001+
List of locales shown in language selector. The first locale will be used as the default if user browser's language doesn't match any locale in the list.
10011002
- `NAMES`: **English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,日本語,español,português do Brasil,Português de Portugal,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어,ελληνικά,فارسی,magyar nyelv,bahasa Indonesia,മലയാളം**: Visible names corresponding to the locales
10021003

10031004
## U2F (`U2F`) **DEPRECATED**

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ LANGS = en-US,foo-BAR
299299
NAMES = English,FooBar
300300
```
301301

302+
The first locale will be used as the default if user browser's language doesn't match any locale in the list.
303+
302304
Locales may change between versions, so keeping track of your customized locales is highly encouraged.
303305

304306
### Readmes

docs/content/doc/packages/overview.en-us.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,29 @@ The following package managers are currently supported:
3838

3939
**The following paragraphs only apply if Packages are not globally disabled!**
4040

41+
## Repository-Packages
42+
43+
A package always belongs to an owner (a user or organisation), not a repository.
44+
To link an (already uploaded) package to a repository, open the settings page
45+
on that package and choose a repository to link this package to.
46+
The entire package will be linked, not just a single version.
47+
48+
Linking a package results in showing that package in the repository's package list,
49+
and shows a link to the repository on the package site (as well as a link to the repository issues).
50+
51+
## Access Restrictions
52+
53+
| Package owner type | User | Organization |
54+
|--------------------|------|--------------|
55+
| **read** access | public, if user is public too; otherwise for this user only | public, if org is public, otherwise org members only |
56+
| **write** access | owner only | org members with admin or write access to the org |
57+
58+
N.B.: These access restrictions are [subject to change](https://github.com/go-gitea/gitea/issues/19270), where more finegrained control will be added via a dedicated organization team permission.
59+
60+
## Create or upload a package
61+
62+
Depending on the type of package, use the respective package-manager for that. Check out the sub-page of a specific package manager for instructions.
63+
4164
## View packages
4265

4366
You can view the packages of a repository on the repository page.

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ require (
7878
github.com/stretchr/testify v1.7.0
7979
github.com/syndtr/goleveldb v1.0.0
8080
github.com/tstranex/u2f v1.0.0
81-
github.com/unknwon/com v1.0.1
82-
github.com/unknwon/i18n v0.0.0-20210904045753-ff3a8617e361
83-
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae
8481
github.com/unrolled/render v1.4.1
8582
github.com/urfave/cli v1.22.5
8683
github.com/xanzy/go-gitlab v0.58.0
@@ -101,7 +98,7 @@ require (
10198
gopkg.in/yaml.v2 v2.4.0
10299
mvdan.cc/xurls/v2 v2.4.0
103100
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
104-
xorm.io/builder v0.3.9
101+
xorm.io/builder v0.3.10
105102
xorm.io/xorm v1.2.5
106103
)
107104

@@ -251,6 +248,7 @@ require (
251248
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
252249
github.com/toqueteos/webbrowser v1.2.0 // indirect
253250
github.com/ulikunitz/xz v0.5.10 // indirect
251+
github.com/unknwon/com v1.0.1 // indirect
254252
github.com/x448/float16 v0.8.4 // indirect
255253
github.com/xanzy/ssh-agent v0.3.1 // indirect
256254
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,10 +1503,6 @@ github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o
15031503
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
15041504
github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs=
15051505
github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
1506-
github.com/unknwon/i18n v0.0.0-20210904045753-ff3a8617e361 h1:4Ij5sX4JEzCCY/CCl8trJHey1tPsIDomYTZf145GKk0=
1507-
github.com/unknwon/i18n v0.0.0-20210904045753-ff3a8617e361/go.mod h1:+5rDk6sDGpl3azws3O+f+GpFSyN9GVr0K8cvQLQM2ZQ=
1508-
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae h1:ihaXiJkaca54IaCSnEXtE/uSZOmPxKZhDfVLrzZLFDs=
1509-
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae/go.mod h1:1fdkY6xxl6ExVs2QFv7R0F5IRZHKA8RahhB9fMC9RvM=
15101506
github.com/unrolled/render v1.4.1 h1:VdpMc2YkAOWzbmC/P2yoHhRDXgsaCQHcTJ1KK6SNCA4=
15111507
github.com/unrolled/render v1.4.1/go.mod h1:cK4RSTTVdND5j9EYEc0LAMOvdG11JeiKjyjfyZRvV2w=
15121508
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
@@ -2272,7 +2268,6 @@ gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AW
22722268
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
22732269
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
22742270
gopkg.in/ini.v1 v1.44.2/go.mod h1:M3Cogqpuv0QCi3ExAY5V4uOt4qb/R3xZubo9m8lK5wg=
2275-
gopkg.in/ini.v1 v1.46.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
22762271
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
22772272
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
22782273
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
@@ -2353,7 +2348,8 @@ sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
23532348
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
23542349
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 h1:mUcz5b3FJbP5Cvdq7Khzn6J9OCUQJaBwgBkCR+MOwSs=
23552350
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:FJGmPh3vz9jSos1L/F91iAgnC/aejc0wIIrF2ZwJxdY=
2356-
xorm.io/builder v0.3.9 h1:Sd65/LdWyO7LR8+Cbd+e7mm3sK/7U9k0jS3999IDHMc=
23572351
xorm.io/builder v0.3.9/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
2352+
xorm.io/builder v0.3.10 h1:Rvkncad3Lo9YIVqCbgIf6QnpR/HcW3IEr0AANNpuyMQ=
2353+
xorm.io/builder v0.3.10/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
23582354
xorm.io/xorm v1.2.5 h1:tqN7OhN8P9xi52qBb76I8m5maAJMz/SSbgK2RGPCPbo=
23592355
xorm.io/xorm v1.2.5/go.mod h1:fTG8tSjk6O1BYxwuohZUK+S1glnRycsCF05L1qQyEU0=

integrations/api_repo_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,27 @@ func testAPIRepoMigrateConflict(t *testing.T, u *url.URL) {
405405
})
406406
}
407407

408+
// mirror-sync must fail with "400 (Bad Request)" when an attempt is made to
409+
// sync a non-mirror repository.
410+
func TestAPIMirrorSyncNonMirrorRepo(t *testing.T) {
411+
defer prepareTestEnv(t)()
412+
413+
session := loginUser(t, "user2")
414+
token := getTokenForLoggedInUser(t, session)
415+
416+
var repo api.Repository
417+
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1")
418+
resp := MakeRequest(t, req, http.StatusOK)
419+
DecodeJSON(t, resp, &repo)
420+
assert.EqualValues(t, false, repo.Mirror)
421+
422+
req = NewRequestf(t, "POST", "/api/v1/repos/user2/repo1/mirror-sync?token=%s", token)
423+
resp = session.MakeRequest(t, req, http.StatusBadRequest)
424+
errRespJSON := map[string]string{}
425+
DecodeJSON(t, resp, &errRespJSON)
426+
assert.Equal(t, "Repository is not a mirror", errRespJSON["message"])
427+
}
428+
408429
func TestAPIOrgRepoCreate(t *testing.T) {
409430
testCases := []struct {
410431
ctxUserID int64

integrations/auth_ldap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import (
1616
"code.gitea.io/gitea/models/organization"
1717
"code.gitea.io/gitea/models/unittest"
1818
user_model "code.gitea.io/gitea/models/user"
19+
"code.gitea.io/gitea/modules/translation/i18n"
1920
"code.gitea.io/gitea/services/auth"
2021

2122
"github.com/stretchr/testify/assert"
22-
"github.com/unknwon/i18n"
2323
)
2424

2525
type ldapUser struct {

integrations/branches_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import (
99
"net/url"
1010
"testing"
1111

12+
"code.gitea.io/gitea/modules/translation/i18n"
13+
1214
"github.com/stretchr/testify/assert"
13-
"github.com/unknwon/i18n"
1415
)
1516

1617
func TestViewBranches(t *testing.T) {

integrations/goget_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ func TestGoGet(t *testing.T) {
2929
<body>
3030
go get --insecure %[1]s:%[2]s/blah/glah
3131
</body>
32-
</html>
33-
`, setting.Domain, setting.HTTPPort, setting.AppURL)
32+
</html>`, setting.Domain, setting.HTTPPort, setting.AppURL)
3433

3534
assert.Equal(t, expected, resp.Body.String())
3635
}

integrations/integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func prepareTestEnv(t testing.TB, skip ...int) func() {
254254
assert.NoError(t, unittest.LoadFixtures())
255255
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
256256

257-
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
257+
assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
258258
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
259259
if err != nil {
260260
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
@@ -550,7 +550,7 @@ func resetFixtures(t *testing.T) {
550550
assert.NoError(t, queue.GetManager().FlushAll(context.Background(), -1))
551551
assert.NoError(t, unittest.LoadFixtures())
552552
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
553-
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
553+
assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
554554
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
555555
if err != nil {
556556
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)

integrations/migration-test/migration_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"code.gitea.io/gitea/integrations"
2222
"code.gitea.io/gitea/models/db"
2323
"code.gitea.io/gitea/models/migrations"
24+
"code.gitea.io/gitea/models/unittest"
2425
"code.gitea.io/gitea/modules/base"
2526
"code.gitea.io/gitea/modules/charset"
2627
"code.gitea.io/gitea/modules/git"
@@ -60,7 +61,7 @@ func initMigrationTest(t *testing.T) func() {
6061

6162
assert.True(t, len(setting.RepoRootPath) != 0)
6263
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
63-
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
64+
assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
6465
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
6566
if err != nil {
6667
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)

integrations/mirror_pull_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func TestMirrorPull(t *testing.T) {
4646
Status: repo_model.RepositoryBeingMigrated,
4747
})
4848
assert.NoError(t, err)
49+
assert.True(t, mirrorRepo.IsMirror, "expected pull-mirror repo to be marked as a mirror immediately after its creation")
4950

5051
ctx := context.Background()
5152

integrations/pull_merge_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import (
2424
"code.gitea.io/gitea/modules/git"
2525
api "code.gitea.io/gitea/modules/structs"
2626
"code.gitea.io/gitea/modules/test"
27+
"code.gitea.io/gitea/modules/translation/i18n"
2728
"code.gitea.io/gitea/services/pull"
2829

2930
"github.com/stretchr/testify/assert"
30-
"github.com/unknwon/i18n"
3131
)
3232

3333
func testPullMerge(t *testing.T, session *TestSession, user, repo, pullnum string, mergeStyle repo_model.MergeStyle) *httptest.ResponseRecorder {

integrations/release_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import (
1414
"code.gitea.io/gitea/models/unittest"
1515
"code.gitea.io/gitea/modules/setting"
1616
"code.gitea.io/gitea/modules/test"
17+
"code.gitea.io/gitea/modules/translation/i18n"
1718

1819
"github.com/PuerkitoBio/goquery"
1920
"github.com/stretchr/testify/assert"
20-
"github.com/unknwon/i18n"
2121
)
2222

2323
func createNewRelease(t *testing.T, session *TestSession, repoURL, tag, title string, preRelease, draft bool) {

integrations/repo_branch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313

1414
"code.gitea.io/gitea/modules/setting"
1515
"code.gitea.io/gitea/modules/test"
16+
"code.gitea.io/gitea/modules/translation/i18n"
1617

1718
"github.com/stretchr/testify/assert"
18-
"github.com/unknwon/i18n"
1919
)
2020

2121
func testCreateBranch(t testing.TB, session *TestSession, user, repo, oldRefSubURL, newBranchName string, expectedStatus int) string {

integrations/signin_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111

1212
"code.gitea.io/gitea/models/unittest"
1313
user_model "code.gitea.io/gitea/models/user"
14+
"code.gitea.io/gitea/modules/translation/i18n"
1415

1516
"github.com/stretchr/testify/assert"
16-
"github.com/unknwon/i18n"
1717
)
1818

1919
func testLoginFailed(t *testing.T, username, password, message string) {

integrations/signup_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
"code.gitea.io/gitea/models/unittest"
1414
user_model "code.gitea.io/gitea/models/user"
1515
"code.gitea.io/gitea/modules/setting"
16+
"code.gitea.io/gitea/modules/translation/i18n"
1617

1718
"github.com/stretchr/testify/assert"
18-
"github.com/unknwon/i18n"
1919
)
2020

2121
func TestSignup(t *testing.T) {
@@ -68,9 +68,9 @@ func TestSignupEmail(t *testing.T) {
6868
wantStatus int
6969
wantMsg string
7070
}{
71-
{"[email protected]\r\n", http.StatusOK, i18n.Tr("en", "form.email_invalid", nil)},
72-
{"[email protected]\r", http.StatusOK, i18n.Tr("en", "form.email_invalid", nil)},
73-
{"[email protected]\n", http.StatusOK, i18n.Tr("en", "form.email_invalid", nil)},
71+
{"[email protected]\r\n", http.StatusOK, i18n.Tr("en", "form.email_invalid")},
72+
{"[email protected]\r", http.StatusOK, i18n.Tr("en", "form.email_invalid")},
73+
{"[email protected]\n", http.StatusOK, i18n.Tr("en", "form.email_invalid")},
7474
{"[email protected]", http.StatusSeeOther, ""},
7575
}
7676

integrations/user_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111
"code.gitea.io/gitea/models/unittest"
1212
user_model "code.gitea.io/gitea/models/user"
1313
"code.gitea.io/gitea/modules/test"
14+
"code.gitea.io/gitea/modules/translation/i18n"
1415

1516
"github.com/stretchr/testify/assert"
16-
"github.com/unknwon/i18n"
1717
)
1818

1919
func TestViewUser(t *testing.T) {

models/migrations/migrations_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"code.gitea.io/gitea/modules/util"
2525

2626
"github.com/stretchr/testify/assert"
27-
"github.com/unknwon/com"
2827
"xorm.io/xorm"
2928
"xorm.io/xorm/names"
3029
)
@@ -204,7 +203,7 @@ func prepareTestEnv(t *testing.T, skip int, syncModels ...interface{}) (*xorm.En
204203
deferFn := PrintCurrentTest(t, ourSkip)
205204
assert.NoError(t, os.RemoveAll(setting.RepoRootPath))
206205

207-
assert.NoError(t, com.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"),
206+
assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"),
208207
setting.RepoRootPath))
209208
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
210209
if err != nil {

0 commit comments

Comments
 (0)