fix(i18n): reuse string for repository access, fix capitalization consistency (#11683)

Followup to https://codeberg.org/forgejo/forgejo/pulls/11604

These strings are used in similar contexts and can be reused. Fixed capitalization consistency (`specific_repo_access` inherited capitalization from `repo_and_org_access` which was nearby in the UI)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11683
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
0ko 2026-03-15 15:09:43 +01:00 committed by Mathieu Fenniak
parent 1d99ce0242
commit a480324595
5 changed files with 11 additions and 9 deletions

View file

@ -284,14 +284,17 @@ func TestAccessTokenRegenerate(t *testing.T) {
func TestAccessTokenResourceRepos(t *testing.T) {
defer tests.PrepareTestEnv(t)()
locale := translation.NewLocale("en-US")
repoAccess := locale.TrString("settings.specific_repo_access") + ":"
session := loginUser(t, "user2")
// Before creating a repo-specific access token, we shouldn't have the "Repository Access:" list in the personal
// Before creating a repo-specific access token, we shouldn't have the "Repository access:" list in the personal
// access token page:
req := NewRequest(t, "GET", "/user/settings/applications")
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content p", "Repository Access:"), false)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content p", repoAccess), false)
// Then we create a repo-specific access token. We give it access to two repos, user2/repo2, but also user30/empty,
// a private repo owned by someone else... We'll pretend user2 used to be a collaborator on this repo and
@ -301,11 +304,11 @@ func TestAccessTokenResourceRepos(t *testing.T) {
[]int64{2, 52},
)
// Now we have "Repository Access:"...
// Now we have "Repository access:"...
req = NewRequest(t, "GET", "/user/settings/applications")
resp = session.MakeRequest(t, req, http.StatusOK)
htmlDoc = NewHTMLParser(t, resp.Body)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content p", "Repository Access:"), true)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content p", repoAccess), true)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content a", "user2/repo2"), true) // link to repo
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content a", "user30/empty"), false) // missing - user2 has no visibility
}