[GITEA] Use correct translations for pull request

- When a commit references a pull request, the detail strings should
reflect that. Add a new translation string for the pull request.
- Added integration tests.
- Resolves #2256

(cherry picked from commit 0d054cd4d998957bd499bfebe4002290526c5b92)
This commit is contained in:
Gusted 2024-01-28 20:17:46 +01:00 committed by Earl Warren
parent b26d037c62
commit 361617eea0
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 50 additions and 1 deletions

View file

@ -0,0 +1,17 @@
-
id: 1000
type: 4 # commit ref
poster_id: 2
issue_id: 2 # in repo_id 2
content: 4a357436d925b5c974181ff12a994538ddc5a269
created_unix: 1706469348
updated_unix: 1706469348
-
id: 1001
type: 4 # commit ref
poster_id: 2
issue_id: 1 # in repo_id 2
content: 4a357436d925b5c974181ff12a994538ddc5a269
created_unix: 1706469348
updated_unix: 1706469348

View file

@ -770,3 +770,30 @@ func TestGetContentHistory(t *testing.T) {
testCase(t, loginUser(t, "user5"), true)
})
}
func TestCommitRefComment(t *testing.T) {
defer tests.AddFixtures("tests/integration/fixtures/TestCommitRefComment/")()
defer tests.PrepareTestEnv(t)()
t.Run("Pull request", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
req := NewRequest(t, "GET", "/user2/repo1/pulls/2")
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
event := htmlDoc.Find("#issuecomment-1000 .text").Text()
assert.Contains(t, event, "referenced this pull request")
})
t.Run("Issue", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
req := NewRequest(t, "GET", "/user2/repo1/issues/1")
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
event := htmlDoc.Find("#issuecomment-1001 .text").Text()
assert.Contains(t, event, "referenced this issue")
})
}