mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
[v14.0/forgejo] feat(ui): show update time when sorting by recently updated (#10500)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/10488 Fixes #4712 Fixes #7783 When filtering issues or PRs by "Recently updated" or "Least recently updated", the last updated time is shown:   Co-authored-by: Bram Hagens <bram@bramh.me> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10500 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
44102c47d4
commit
83da3ae68c
3 changed files with 37 additions and 0 deletions
|
|
@ -62,6 +62,7 @@
|
|||
"repo.issues.filter_mention.hint": "Filter by mentioned user",
|
||||
"repo.issues.filter_modified.hint": "Filter by last modified date",
|
||||
"repo.issues.filter_sort.hint": "Sort by: created/comments/updated/deadline",
|
||||
"issues.updated": "updated %s",
|
||||
"repo.pulls.poster_manage_approval": "Manage approval",
|
||||
"repo.pulls.poster_requires_approval": "Some workflows are <a href=\"%[1]s\">waiting to be reviewed.</a>",
|
||||
"repo.pulls.poster_requires_approval.tooltip": "The author of this pull request is not trusted to run workflows triggered by a pull request created from a forked repository or with AGit. The workflows triggered by a `pull_request` event will not run until they are approved.",
|
||||
|
|
|
|||
|
|
@ -142,6 +142,12 @@
|
|||
</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if or (eq $.SortType "recentupdate") (eq $.SortType "leastupdate")}}
|
||||
<span class="flex-text-inline">
|
||||
{{svg "octicon-history" 14}}
|
||||
{{ctx.Locale.Tr "issues.updated" (DateUtils.TimeSince .UpdatedUnix)}}
|
||||
</span>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -131,6 +131,36 @@ func TestViewIssuesSortByType(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestViewIssuesSortByUpdatedTime(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
|
||||
// When sorting by update time, the "updated" text and icon should appear
|
||||
for _, sort := range []string{"recentupdate", "leastupdate"} {
|
||||
req := NewRequest(t, "GET", repo.Link()+"/issues?sort="+sort)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
issueList := htmlDoc.doc.Find("#issue-list")
|
||||
updatedText := issueList.Find(".flex-item-body").First().Text()
|
||||
assert.Contains(t, updatedText, "updated")
|
||||
|
||||
historyIcon := issueList.Find(".octicon-history")
|
||||
assert.Positive(t, historyIcon.Length())
|
||||
}
|
||||
|
||||
// When sorting by something else, the "updated" text and icon should NOT appear
|
||||
req := NewRequest(t, "GET", repo.Link()+"/issues?sort=latest")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
issueList := htmlDoc.doc.Find("#issue-list")
|
||||
historyIcon := issueList.Find(".octicon-history")
|
||||
assert.Empty(t, historyIcon.Length())
|
||||
}
|
||||
|
||||
func TestViewIssuesKeyword(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue