mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-11 04:11:18 +01:00
[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 0d054cd4d9
)
This commit is contained in:
parent
b26d037c62
commit
361617eea0
4 changed files with 50 additions and 1 deletions
|
@ -1832,6 +1832,7 @@ pulls.outdated_with_base_branch = This branch is out-of-date with the base branc
|
||||||
pulls.close = Close Pull Request
|
pulls.close = Close Pull Request
|
||||||
pulls.closed_at = `closed this pull request <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
pulls.closed_at = `closed this pull request <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
||||||
pulls.reopened_at = `reopened this pull request <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
pulls.reopened_at = `reopened this pull request <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
||||||
|
pulls.commit_ref_at = `referenced this pull request from a commit <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
||||||
pulls.cmd_instruction_hint = `View <a class="show-instruction">command line instructions</a>.`
|
pulls.cmd_instruction_hint = `View <a class="show-instruction">command line instructions</a>.`
|
||||||
pulls.cmd_instruction_checkout_title = Checkout
|
pulls.cmd_instruction_checkout_title = Checkout
|
||||||
pulls.cmd_instruction_checkout_desc = From your project repository, check out a new branch and test the changes.
|
pulls.cmd_instruction_checkout_desc = From your project repository, check out a new branch and test the changes.
|
||||||
|
|
|
@ -152,7 +152,11 @@
|
||||||
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
||||||
<span class="text grey muted-links">
|
<span class="text grey muted-links">
|
||||||
{{template "shared/user/authorlink" .Poster}}
|
{{template "shared/user/authorlink" .Poster}}
|
||||||
{{ctx.Locale.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}}
|
{{if .Issue.IsPull}}
|
||||||
|
{{ctx.Locale.Tr "repo.pulls.commit_ref_at" .EventTag $createdStr | Safe}}
|
||||||
|
{{else}}
|
||||||
|
{{ctx.Locale.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}}
|
||||||
|
{{end}}
|
||||||
</span>
|
</span>
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
{{svg "octicon-git-commit"}}
|
{{svg "octicon-git-commit"}}
|
||||||
|
|
17
tests/integration/fixtures/TestCommitRefComment/comment.yml
Normal file
17
tests/integration/fixtures/TestCommitRefComment/comment.yml
Normal 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
|
|
@ -770,3 +770,30 @@ func TestGetContentHistory(t *testing.T) {
|
||||||
testCase(t, loginUser(t, "user5"), true)
|
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")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue