Skip to content

Commit fc65947

Browse files
authored
Merge branch 'main' into lunny/fix_assign_project
2 parents b53d1a0 + cdd6371 commit fc65947

File tree

340 files changed

+4353
-3972
lines changed

Some content is hidden

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

340 files changed

+4353
-3972
lines changed

SECURITY.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ Please **DO NOT** file a public issue, instead send your report privately to `se
1111

1212
Due to the sensitive nature of security information, you can use below GPG public key encrypt your mail body.
1313

14-
The PGP key is valid until June 24, 2024.
15-
Key ID: 6FCD2D5B
16-
Key Type: RSA
17-
Expires: 6/24/2024
18-
Key Size: 4096/4096
19-
Fingerprint: 3DE0 3D1E 144A 7F06 9359 99DC AAFD 2381 6FCD 2D5B
14+
The PGP key is valid until June 24, 2024.
15+
Key ID: 6FCD2D5B
16+
Key Type: RSA
17+
Expires: 6/24/2024
18+
Key Size: 4096/4096
19+
Fingerprint: 3DE0 3D1E 144A 7F06 9359 99DC AAFD 2381 6FCD 2D5B
2020
UserID: Gitea Security <[email protected]>
2121

2222
```

custom/conf/app.example.ini

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -475,20 +475,6 @@ ENABLE = true
475475
;; Maximum length of oauth2 token/cookie stored on server
476476
;MAX_TOKEN_LENGTH = 32767
477477

478-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
479-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
480-
[U2F]
481-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
482-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
483-
;;
484-
;; NOTE: THE DEFAULT VALUES HERE WILL NEED TO BE CHANGED
485-
;; Two Factor authentication with security keys
486-
;; https://developers.yubico.com/U2F/App_ID.html
487-
;;
488-
;; DEPRECATED - this only applies to previously registered security keys using the U2F standard
489-
APP_ID = ; e.g. http://localhost:3000/
490-
491-
492478
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
493479
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
494480
[log]
@@ -1097,6 +1083,9 @@ PATH =
10971083
;; Number of items that are displayed in home feed
10981084
;FEED_PAGING_NUM = 20
10991085
;;
1086+
;; Number of items that are displayed in a single subsitemap
1087+
;SITEMAP_PAGING_NUM = 20
1088+
;;
11001089
;; Number of maximum commits displayed in commit graph.
11011090
;GRAPH_MAX_COMMIT_NUM = 100
11021091
;;
@@ -2124,7 +2113,7 @@ PATH =
21242113
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21252114
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21262115
;; The first locale will be used as the default if user browser's language doesn't match any locale in the list.
2127-
;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
2116+
;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,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN
21282117
;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,മലയാളം
21292118

21302119
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
174174
- `MEMBERS_PAGING_NUM`: **20**: Number of members that are shown in organization members.
175175
- `FEED_MAX_COMMIT_NUM`: **5**: Number of maximum commits shown in one activity feed.
176176
- `FEED_PAGING_NUM`: **20**: Number of items that are displayed in home feed.
177+
- `SITEMAP_PAGING_NUM`: **20**: Number of items that are displayed in a single subsitemap.
177178
- `GRAPH_MAX_COMMIT_NUM`: **100**: Number of maximum commits shown in the commit graph.
178179
- `CODE_COMMENT_LINES`: **4**: Number of line of codes shown for a code comment.
179180
- `DEFAULT_THEME`: **auto**: \[auto, gitea, arc-green\]: Set the default theme for the Gitea install.
@@ -998,13 +999,10 @@ Default templates for project boards:
998999

9991000
## i18n (`i18n`)
10001001

1001-
- `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**:
1002+
- `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,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN**:
10021003
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.
10031004
- `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
10041005

1005-
## U2F (`U2F`) **DEPRECATED**
1006-
- `APP_ID`: **`ROOT_URL`**: Declares the facet of the application which is used for authentication of previously registered U2F keys. Requires HTTPS.
1007-
10081006
## Markup (`markup`)
10091007

10101008
- `MERMAID_MAX_SOURCE_CHARACTERS`: **5000**: Set the maximum size of a Mermaid source. (Set to -1 to disable)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ The list of themes a user can choose from can be configured with the `THEMES` va
335335

336336
To make a custom theme available to all users:
337337

338-
1. Add a CSS file to `$GITEA_PUBLIC/public/css/theme-<theme-name>.css`.
339-
The value of `$GITEA_PUBLIC` of your instance can be queried by calling `gitea help` and looking up the value of "CustomPath".
338+
1. Add a CSS file to `$GITEA_CUSTOM/public/css/theme-<theme-name>.css`.
339+
The value of `$GITEA_CUSTOM` of your instance can be queried by calling `gitea help` and looking up the value of "CustomPath".
340340
2. Add `<theme-name>` to the comma-separated list of setting `THEMES` in `app.ini`
341341

342342
Community themes are listed in [gitea/awesome-gitea#themes](https://gitea.com/gitea/awesome-gitea#themes).

docs/content/doc/developers/oauth2-provider.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ To use the Authorization Code Grant as a third party application it is required
4141

4242
## Scopes
4343

44-
Currently Gitea does not support scopes (see [#4300](https://github.com/go-gitea/gitea/issues/4300)) and all third party applications will be granted access to all resources of the user and his/her organizations.
44+
Currently Gitea does not support scopes (see [#4300](https://github.com/go-gitea/gitea/issues/4300)) and all third party applications will be granted access to all resources of the user and their organizations.
4545

4646
## Example
4747

4848
**Note:** This example does not use PKCE.
4949

50-
1. Redirect to user to the authorization endpoint in order to get his/her consent for accessing the resources:
50+
1. Redirect to user to the authorization endpoint in order to get their consent for accessing the resources:
5151

5252
```curl
5353
https://[YOUR-GITEA-URL]/login/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI& response_type=code&state=STATE

docs/content/doc/developers/oauth2-provider.zh-tw.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Gitea 支援作為 OAuth2 提供者,能讓第三方程式能在使用者同意
4646
**備註:** 此範例未使用 PKCE。
4747

4848
1. 重新導向使用者到 authorization endpoint 以獲得他同意授權存取資源:
49-
<!-- 1. Redirect to user to the authorization endpoint in order to get his/her consent for accessing the resources: -->
49+
<!-- 1. Redirect to user to the authorization endpoint in order to get their consent for accessing the resources: -->
5050

5151
```curl
5252
https://[YOUR-GITEA-URL]/login/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI& response_type=code&state=STATE

docs/content/doc/features/comparison.zh-tw.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ menu:
5050
| 有寫入權限的儲存庫 Token ||||||||
5151
| 內建 Container Registry | [](https://github.com/go-gitea/gitea/issues/2316) |||||||
5252
| 對外部 Git 鏡像 ||||||||
53-
| FIDO U2F (2FA) ||||||||
53+
| FIDO (2FA) ||||||||
5454
| 內建 CI/CD ||||||||
5555
| 子群組: 群組中的群組 ||||||||
5656

integrations/auth_ldap_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ 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"
19+
"code.gitea.io/gitea/modules/translation"
2020
"code.gitea.io/gitea/services/auth"
2121

2222
"github.com/stretchr/testify/assert"
@@ -275,8 +275,7 @@ func TestLDAPUserSigninFailed(t *testing.T) {
275275
addAuthSourceLDAP(t, "")
276276

277277
u := otherLDAPUsers[0]
278-
279-
testLoginFailed(t, u.UserName, u.Password, i18n.Tr("en", "form.username_password_incorrect"))
278+
testLoginFailed(t, u.UserName, u.Password, translation.NewLocale("en-US").Tr("form.username_password_incorrect"))
280279
}
281280

282281
func TestLDAPUserSSHKeySync(t *testing.T) {

integrations/branches_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"net/url"
1010
"testing"
1111

12-
"code.gitea.io/gitea/modules/translation/i18n"
12+
"code.gitea.io/gitea/modules/translation"
1313

1414
"github.com/stretchr/testify/assert"
1515
)
@@ -37,7 +37,7 @@ func TestUndoDeleteBranch(t *testing.T) {
3737
htmlDoc, name := branchAction(t, ".undo-button")
3838
assert.Contains(t,
3939
htmlDoc.doc.Find(".ui.positive.message").Text(),
40-
i18n.Tr("en", "repo.branch.restore_success", name),
40+
translation.NewLocale("en-US").Tr("repo.branch.restore_success", name),
4141
)
4242
})
4343
}
@@ -46,7 +46,7 @@ func deleteBranch(t *testing.T) {
4646
htmlDoc, name := branchAction(t, ".delete-branch-button")
4747
assert.Contains(t,
4848
htmlDoc.doc.Find(".ui.positive.message").Text(),
49-
i18n.Tr("en", "repo.branch.deletion_success", name),
49+
translation.NewLocale("en-US").Tr("repo.branch.deletion_success", name),
5050
)
5151
}
5252

integrations/pull_merge_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"code.gitea.io/gitea/modules/git"
2828
api "code.gitea.io/gitea/modules/structs"
2929
"code.gitea.io/gitea/modules/test"
30-
"code.gitea.io/gitea/modules/translation/i18n"
30+
"code.gitea.io/gitea/modules/translation"
3131
"code.gitea.io/gitea/services/pull"
3232
repo_service "code.gitea.io/gitea/services/repository"
3333
files_service "code.gitea.io/gitea/services/repository/files"
@@ -204,7 +204,7 @@ func TestCantMergeWorkInProgress(t *testing.T) {
204204
text := strings.TrimSpace(htmlDoc.doc.Find(".merge-section > .item").Last().Text())
205205
assert.NotEmpty(t, text, "Can't find WIP text")
206206

207-
assert.Contains(t, text, i18n.Tr("en", "repo.pulls.cannot_merge_work_in_progress"), "Unable to find WIP text")
207+
assert.Contains(t, text, translation.NewLocale("en-US").Tr("repo.pulls.cannot_merge_work_in_progress"), "Unable to find WIP text")
208208
assert.Contains(t, text, "[wip]", "Unable to find WIP text")
209209
})
210210
}

integrations/release_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ 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"
17+
"code.gitea.io/gitea/modules/translation"
1818

1919
"github.com/PuerkitoBio/goquery"
2020
"github.com/stretchr/testify/assert"
@@ -86,7 +86,7 @@ func TestCreateRelease(t *testing.T) {
8686
session := loginUser(t, "user2")
8787
createNewRelease(t, session, "/user2/repo1", "v0.0.1", "v0.0.1", false, false)
8888

89-
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.1", i18n.Tr("en", "repo.release.stable"), 4)
89+
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.1", translation.NewLocale("en-US").Tr("repo.release.stable"), 4)
9090
}
9191

9292
func TestCreateReleasePreRelease(t *testing.T) {
@@ -95,7 +95,7 @@ func TestCreateReleasePreRelease(t *testing.T) {
9595
session := loginUser(t, "user2")
9696
createNewRelease(t, session, "/user2/repo1", "v0.0.1", "v0.0.1", true, false)
9797

98-
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.1", i18n.Tr("en", "repo.release.prerelease"), 4)
98+
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.1", translation.NewLocale("en-US").Tr("repo.release.prerelease"), 4)
9999
}
100100

101101
func TestCreateReleaseDraft(t *testing.T) {
@@ -104,7 +104,7 @@ func TestCreateReleaseDraft(t *testing.T) {
104104
session := loginUser(t, "user2")
105105
createNewRelease(t, session, "/user2/repo1", "v0.0.1", "v0.0.1", false, true)
106106

107-
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.1", i18n.Tr("en", "repo.release.draft"), 4)
107+
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.1", translation.NewLocale("en-US").Tr("repo.release.draft"), 4)
108108
}
109109

110110
func TestCreateReleasePaging(t *testing.T) {
@@ -124,11 +124,11 @@ func TestCreateReleasePaging(t *testing.T) {
124124
}
125125
createNewRelease(t, session, "/user2/repo1", "v0.0.12", "v0.0.12", false, true)
126126

127-
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.12", i18n.Tr("en", "repo.release.draft"), 10)
127+
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.12", translation.NewLocale("en-US").Tr("repo.release.draft"), 10)
128128

129129
// Check that user4 does not see draft and still see 10 latest releases
130130
session2 := loginUser(t, "user4")
131-
checkLatestReleaseAndCount(t, session2, "/user2/repo1", "v0.0.11", i18n.Tr("en", "repo.release.stable"), 10)
131+
checkLatestReleaseAndCount(t, session2, "/user2/repo1", "v0.0.11", translation.NewLocale("en-US").Tr("repo.release.stable"), 10)
132132
}
133133

134134
func TestViewReleaseListNoLogin(t *testing.T) {

integrations/repo_branch_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

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

1818
"github.com/stretchr/testify/assert"
1919
)
@@ -52,37 +52,37 @@ func testCreateBranches(t *testing.T, giteaURL *url.URL) {
5252
OldRefSubURL: "branch/master",
5353
NewBranch: "feature/test1",
5454
ExpectedStatus: http.StatusSeeOther,
55-
FlashMessage: i18n.Tr("en", "repo.branch.create_success", "feature/test1"),
55+
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.create_success", "feature/test1"),
5656
},
5757
{
5858
OldRefSubURL: "branch/master",
5959
NewBranch: "",
6060
ExpectedStatus: http.StatusSeeOther,
61-
FlashMessage: i18n.Tr("en", "form.NewBranchName") + i18n.Tr("en", "form.require_error"),
61+
FlashMessage: translation.NewLocale("en-US").Tr("form.NewBranchName") + translation.NewLocale("en-US").Tr("form.require_error"),
6262
},
6363
{
6464
OldRefSubURL: "branch/master",
6565
NewBranch: "feature=test1",
6666
ExpectedStatus: http.StatusSeeOther,
67-
FlashMessage: i18n.Tr("en", "repo.branch.create_success", "feature=test1"),
67+
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.create_success", "feature=test1"),
6868
},
6969
{
7070
OldRefSubURL: "branch/master",
7171
NewBranch: strings.Repeat("b", 101),
7272
ExpectedStatus: http.StatusSeeOther,
73-
FlashMessage: i18n.Tr("en", "form.NewBranchName") + i18n.Tr("en", "form.max_size_error", "100"),
73+
FlashMessage: translation.NewLocale("en-US").Tr("form.NewBranchName") + translation.NewLocale("en-US").Tr("form.max_size_error", "100"),
7474
},
7575
{
7676
OldRefSubURL: "branch/master",
7777
NewBranch: "master",
7878
ExpectedStatus: http.StatusSeeOther,
79-
FlashMessage: i18n.Tr("en", "repo.branch.branch_already_exists", "master"),
79+
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.branch_already_exists", "master"),
8080
},
8181
{
8282
OldRefSubURL: "branch/master",
8383
NewBranch: "master/test",
8484
ExpectedStatus: http.StatusSeeOther,
85-
FlashMessage: i18n.Tr("en", "repo.branch.branch_name_conflict", "master/test", "master"),
85+
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.branch_name_conflict", "master/test", "master"),
8686
},
8787
{
8888
OldRefSubURL: "commit/acd1d892867872cb47f3993468605b8aa59aa2e0",
@@ -93,21 +93,21 @@ func testCreateBranches(t *testing.T, giteaURL *url.URL) {
9393
OldRefSubURL: "commit/65f1bf27bc3bf70f64657658635e66094edbcb4d",
9494
NewBranch: "feature/test3",
9595
ExpectedStatus: http.StatusSeeOther,
96-
FlashMessage: i18n.Tr("en", "repo.branch.create_success", "feature/test3"),
96+
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.create_success", "feature/test3"),
9797
},
9898
{
9999
OldRefSubURL: "branch/master",
100100
NewBranch: "v1.0.0",
101101
CreateRelease: "v1.0.0",
102102
ExpectedStatus: http.StatusSeeOther,
103-
FlashMessage: i18n.Tr("en", "repo.branch.tag_collision", "v1.0.0"),
103+
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.tag_collision", "v1.0.0"),
104104
},
105105
{
106106
OldRefSubURL: "tag/v1.0.0",
107107
NewBranch: "feature/test4",
108108
CreateRelease: "v1.0.1",
109109
ExpectedStatus: http.StatusSeeOther,
110-
FlashMessage: i18n.Tr("en", "repo.branch.create_success", "feature/test4"),
110+
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.create_success", "feature/test4"),
111111
},
112112
}
113113
for _, test := range tests {

integrations/signin_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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"
14+
"code.gitea.io/gitea/modules/translation"
1515

1616
"github.com/stretchr/testify/assert"
1717
)
@@ -47,10 +47,10 @@ func TestSignin(t *testing.T) {
4747
password string
4848
message string
4949
}{
50-
{username: "wrongUsername", password: "wrongPassword", message: i18n.Tr("en", "form.username_password_incorrect")},
51-
{username: "wrongUsername", password: "password", message: i18n.Tr("en", "form.username_password_incorrect")},
52-
{username: "user15", password: "wrongPassword", message: i18n.Tr("en", "form.username_password_incorrect")},
53-
{username: "[email protected]", password: "wrongPassword", message: i18n.Tr("en", "form.username_password_incorrect")},
50+
{username: "wrongUsername", password: "wrongPassword", message: translation.NewLocale("en-US").Tr("form.username_password_incorrect")},
51+
{username: "wrongUsername", password: "password", message: translation.NewLocale("en-US").Tr("form.username_password_incorrect")},
52+
{username: "user15", password: "wrongPassword", message: translation.NewLocale("en-US").Tr("form.username_password_incorrect")},
53+
{username: "[email protected]", password: "wrongPassword", message: translation.NewLocale("en-US").Tr("form.username_password_incorrect")},
5454
}
5555

5656
for _, s := range samples {

integrations/signup_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ 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"
16+
"code.gitea.io/gitea/modules/translation"
1717

1818
"github.com/stretchr/testify/assert"
1919
)
@@ -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")},
72-
{"[email protected]\r", http.StatusOK, i18n.Tr("en", "form.email_invalid")},
73-
{"[email protected]\n", http.StatusOK, i18n.Tr("en", "form.email_invalid")},
71+
{"[email protected]\r\n", http.StatusOK, translation.NewLocale("en-US").Tr("form.email_invalid")},
72+
{"[email protected]\r", http.StatusOK, translation.NewLocale("en-US").Tr("form.email_invalid")},
73+
{"[email protected]\n", http.StatusOK, translation.NewLocale("en-US").Tr("form.email_invalid")},
7474
{"[email protected]", http.StatusSeeOther, ""},
7575
}
7676

integrations/user_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
user_model "code.gitea.io/gitea/models/user"
1515
api "code.gitea.io/gitea/modules/structs"
1616
"code.gitea.io/gitea/modules/test"
17-
"code.gitea.io/gitea/modules/translation/i18n"
17+
"code.gitea.io/gitea/modules/translation"
1818

1919
"github.com/stretchr/testify/assert"
2020
)
@@ -67,7 +67,7 @@ func TestRenameInvalidUsername(t *testing.T) {
6767
htmlDoc := NewHTMLParser(t, resp.Body)
6868
assert.Contains(t,
6969
htmlDoc.doc.Find(".ui.negative.message").Text(),
70-
i18n.Tr("en", "form.alpha_dash_dot_error"),
70+
translation.NewLocale("en-US").Tr("form.alpha_dash_dot_error"),
7171
)
7272

7373
unittest.AssertNotExistsBean(t, &user_model.User{Name: invalidUsername})
@@ -131,7 +131,7 @@ func TestRenameReservedUsername(t *testing.T) {
131131
htmlDoc := NewHTMLParser(t, resp.Body)
132132
assert.Contains(t,
133133
htmlDoc.doc.Find(".ui.negative.message").Text(),
134-
i18n.Tr("en", "user.form.name_reserved", reservedUsername),
134+
translation.NewLocale("en-US").Tr("user.form.name_reserved", reservedUsername),
135135
)
136136

137137
unittest.AssertNotExistsBean(t, &user_model.User{Name: reservedUsername})

0 commit comments

Comments
 (0)