diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 890d7da475..bcd14719f6 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -103,12 +103,12 @@ {{else}} -
  • +
  • {{svg "octicon-package" 16 "tw-mr-1"}}{{.Name}}
    - {{ctx.Locale.TrN .DownloadCount "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .DownloadCount)}} · {{.Size | ctx.Locale.TrSize}} + {{ctx.Locale.TrN .DownloadCount "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .DownloadCount)}} · {{DateUtils.TimeSince .CreatedUnix}} · {{.Size | ctx.Locale.TrSize}}
  • {{end}} diff --git a/tests/integration/release_test.go b/tests/integration/release_test.go index f9ce3c81de..8e2ec20c76 100644 --- a/tests/integration/release_test.go +++ b/tests/integration/release_test.go @@ -9,6 +9,7 @@ import ( "net/http" "strconv" "testing" + "time" auth_model "forgejo.org/models/auth" "forgejo.org/models/db" @@ -17,6 +18,7 @@ import ( "forgejo.org/modules/setting" api "forgejo.org/modules/structs" "forgejo.org/modules/test" + "forgejo.org/modules/timeutil" "forgejo.org/modules/translation" "forgejo.org/tests" @@ -329,6 +331,23 @@ func TestViewTagsList(t *testing.T) { assert.Equal(t, []string{"v1.0", "delete-tag", "v1.1"}, tagNames) } +func TestAttachmentTimestamp(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "user2/repo1/releases") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + + var timeStamp int64 = 946684800 + unittest.AssertExistsAndLoadBean(t, &repo_model.Attachment{ + UUID: "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a20", + CreatedUnix: timeutil.TimeStamp(timeStamp), + }) + + formattedTime := time.Unix(timeStamp, 0).Format(time.RFC3339) + htmlDoc.AssertElement(t, fmt.Sprintf("details.download relative-time[datetime='%s']", formattedTime), true) +} + func TestDownloadReleaseAttachment(t *testing.T) { defer tests.PrepareTestEnv(t)()