Skip to content

Commit 88caa67

Browse files
authored
Merge branch 'main' into lunny/move_db_tx
2 parents f38464a + e4cb48a commit 88caa67

File tree

6 files changed

+43
-9
lines changed

6 files changed

+43
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ XGO_VERSION := go-1.25.x
2727

2828
AIR_PACKAGE ?= github.com/air-verse/air@v1
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
30-
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.8.0
30+
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.9.1
3131
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/[email protected]
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3333
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected]

build/code-batch-process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func parseArgs() (mainOptions map[string]string, subCmd string, subArgs []string
181181
break
182182
}
183183
}
184-
return
184+
return mainOptions, subCmd, subArgs
185185
}
186186

187187
func showUsage() {

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ require (
287287
gopkg.in/yaml.v2 v2.4.0 // indirect
288288
)
289289

290+
ignore (
291+
./.venv
292+
./node_modules
293+
)
294+
290295
replace github.com/jaytaylor/html2text => github.com/Necoro/html2text v0.0.0-20250804200300-7bf1ce1c7347
291296

292297
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1

options/locale/locale_ga-IE.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,13 @@ repo.transfer.body=Chun glacadh leis nó diúltú dó, tabhair cuairt ar %s nó
551551
repo.collaborator.added.subject=Chuir %s le %s tú
552552
repo.collaborator.added.text=Cuireadh tú leis mar chomhoibritheoir stórais:
553553

554+
repo.actions.run.failed=Theip ar an rith
555+
repo.actions.run.succeeded=D'éirigh leis an rith
556+
repo.actions.run.cancelled=Rith curtha ar ceal
557+
repo.actions.jobs.all_succeeded=D’éirigh le gach post
558+
repo.actions.jobs.all_failed=Theip ar gach post
559+
repo.actions.jobs.some_not_successful=Níor éirigh le roinnt post
560+
repo.actions.jobs.all_cancelled=Tá gach post curtha ar ceal
554561
555562
team_invite.subject=Tá cuireadh tugtha agat ag %[1]s chun dul le heagraíocht %[2]s
556563
team_invite.text_1=Tá cuireadh tugtha ag %[1]s duit chun dul le foireann %[2]s in eagraíocht %[3]s.

routers/web/web.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,10 +1225,11 @@ func registerWebRoutes(m *web.Router) {
12251225
// end "/{username}/{reponame}": view milestone, label, issue, pull, etc
12261226

12271227
m.Group("/{username}/{reponame}/{type:issues}", func() {
1228+
// these handlers also check unit permissions internally
12281229
m.Get("", repo.Issues)
1229-
m.Get("/{index}", repo.ViewIssue)
1230-
}, optSignIn, context.RepoAssignment, context.RequireUnitReader(unit.TypeIssues, unit.TypeExternalTracker))
1231-
// end "/{username}/{reponame}": issue/pull list, issue/pull view, external tracker
1230+
m.Get("/{index}", repo.ViewIssue) // also do pull-request redirection (".../issues/{PR-number}" -> ".../pulls/{PR-number}")
1231+
}, optSignIn, context.RepoAssignment, context.RequireUnitReader(unit.TypeIssues, unit.TypePullRequests, unit.TypeExternalTracker))
1232+
// end "/{username}/{reponame}": issue list, issue view (pull-request redirection), external tracker
12321233

12331234
m.Group("/{username}/{reponame}", func() { // edit issues, pulls, labels, milestones, etc
12341235
m.Group("/issues", func() {

tests/integration/issue_test.go

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import (
1414
"testing"
1515
"time"
1616

17+
"code.gitea.io/gitea/models/db"
1718
issues_model "code.gitea.io/gitea/models/issues"
1819
repo_model "code.gitea.io/gitea/models/repo"
20+
"code.gitea.io/gitea/models/unit"
1921
"code.gitea.io/gitea/models/unittest"
2022
user_model "code.gitea.io/gitea/models/user"
2123
"code.gitea.io/gitea/modules/indexer/issues"
@@ -474,19 +476,38 @@ func TestIssueRedirect(t *testing.T) {
474476
session := loginUser(t, "user2")
475477

476478
// Test external tracker where style not set (shall default numeric)
477-
req := NewRequest(t, "GET", path.Join("org26", "repo_external_tracker", "issues", "1"))
479+
req := NewRequest(t, "GET", "/org26/repo_external_tracker/issues/1")
478480
resp := session.MakeRequest(t, req, http.StatusSeeOther)
479481
assert.Equal(t, "https://tracker.com/org26/repo_external_tracker/issues/1", test.RedirectURL(resp))
480482

481483
// Test external tracker with numeric style
482-
req = NewRequest(t, "GET", path.Join("org26", "repo_external_tracker_numeric", "issues", "1"))
484+
req = NewRequest(t, "GET", "/org26/repo_external_tracker_numeric/issues/1")
483485
resp = session.MakeRequest(t, req, http.StatusSeeOther)
484486
assert.Equal(t, "https://tracker.com/org26/repo_external_tracker_numeric/issues/1", test.RedirectURL(resp))
485487

486488
// Test external tracker with alphanumeric style (for a pull request)
487-
req = NewRequest(t, "GET", path.Join("org26", "repo_external_tracker_alpha", "issues", "1"))
489+
req = NewRequest(t, "GET", "/org26/repo_external_tracker_alpha/issues/1")
488490
resp = session.MakeRequest(t, req, http.StatusSeeOther)
489-
assert.Equal(t, "/"+path.Join("org26", "repo_external_tracker_alpha", "pulls", "1"), test.RedirectURL(resp))
491+
assert.Equal(t, "/org26/repo_external_tracker_alpha/pulls/1", test.RedirectURL(resp))
492+
493+
// test to check that the PR redirection works if the issue unit is disabled
494+
// repo1 is a normal repository with issue unit enabled, visit issue 2(which is a pull request)
495+
// will redirect to pulls
496+
req = NewRequest(t, "GET", "/user2/repo1/issues/2")
497+
resp = session.MakeRequest(t, req, http.StatusSeeOther)
498+
assert.Equal(t, "/user2/repo1/pulls/2", test.RedirectURL(resp))
499+
500+
repoUnit := unittest.AssertExistsAndLoadBean(t, &repo_model.RepoUnit{RepoID: 1, Type: unit.TypeIssues})
501+
502+
// disable issue unit, it will be reset
503+
_, err := db.DeleteByID[repo_model.RepoUnit](t.Context(), repoUnit.ID)
504+
assert.NoError(t, err)
505+
506+
// even if the issue unit is disabled, visiting an issue which is a pull request
507+
// will still redirect to pull request
508+
req = NewRequest(t, "GET", "/user2/repo1/issues/2")
509+
resp = session.MakeRequest(t, req, http.StatusSeeOther)
510+
assert.Equal(t, "/user2/repo1/pulls/2", test.RedirectURL(resp))
490511
}
491512

492513
func TestSearchIssues(t *testing.T) {

0 commit comments

Comments
 (0)