diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl
index b1c7623531e..0ddc9dd36d7 100644
--- a/templates/repo/actions/runs_list.tmpl
+++ b/templates/repo/actions/runs_list.tmpl
@@ -18,7 +18,7 @@
- {{$title := or $run.Title (ctx.Locale.Tr "actions.runs.empty_commit_message")}}
+ {{$title := or $run.Title (ctx.Locale.TrString "actions.runs.empty_commit_message")}}
{{ctx.RenderUtils.RenderCommitMessageLinkSubject $title $run.Link $run.Repo}}
diff --git a/tests/integration/links_test.go b/tests/integration/links_test.go
index d81a6d5ad55..4836cb4e038 100644
--- a/tests/integration/links_test.go
+++ b/tests/integration/links_test.go
@@ -9,18 +9,24 @@ import (
"path"
"testing"
+ "gitea.dev/models/actions"
+ "gitea.dev/models/db"
"gitea.dev/modules/setting"
api "gitea.dev/modules/structs"
"gitea.dev/modules/test"
"gitea.dev/tests"
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
)
-func assertLinkPageComplete(t *testing.T, session *TestSession, link string) {
+func assertLinkPageComplete(t *testing.T, session *TestSession, link string, containStrings ...string) {
req := NewRequest(t, "GET", link)
resp := session.MakeRequest(t, req, http.StatusOK)
assert.True(t, test.IsNormalPageCompleted(resp.Body.String()), "Page did not complete: "+link)
+ for _, s := range containStrings {
+ assert.Contains(t, resp.Body.String(), s, "Page does not contain expected string: "+s)
+ }
}
func TestLinks(t *testing.T) {
@@ -215,26 +221,30 @@ func testLinksAsUser(t *testing.T) {
func testLinksRepoCommon(t *testing.T) {
// repo1 has enabled almost features, so we can test most links
repoLink := "/user2/repo1"
- links := []string{
- "/actions",
- "/packages",
- "/projects",
+
+ err := db.Insert(t.Context(), &actions.ActionRun{Title: "", RepoID: 1})
+ require.NoError(t, err)
+
+ links := map[string][]string{
+ "/actions": {"(empty commit message)"},
+ "/packages": {},
+ "/projects": {},
}
// anonymous user
- for _, link := range links {
- assertLinkPageComplete(t, nil, repoLink+link)
+ for link, strs := range links {
+ assertLinkPageComplete(t, nil, repoLink+link, strs...)
}
// admin/owner user
session := loginUser(t, "user1")
- for _, link := range links {
- assertLinkPageComplete(t, session, repoLink+link)
+ for link, strs := range links {
+ assertLinkPageComplete(t, session, repoLink+link, strs...)
}
// non-admin non-owner user
session = loginUser(t, "user2")
- for _, link := range links {
- assertLinkPageComplete(t, session, repoLink+link)
+ for link, strs := range links {
+ assertLinkPageComplete(t, session, repoLink+link, strs...)
}
}