diff --git a/options/locale_next/locale_en-US.json b/options/locale_next/locale_en-US.json
index d9d23653cd..38d7d18e7e 100644
--- a/options/locale_next/locale_en-US.json
+++ b/options/locale_next/locale_en-US.json
@@ -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 waiting to be reviewed.",
"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.",
diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl
index ff7aa9c0a4..3e20cc5080 100644
--- a/templates/shared/issuelist.tmpl
+++ b/templates/shared/issuelist.tmpl
@@ -142,6 +142,12 @@
{{end}}
{{end}}
+ {{if or (eq $.SortType "recentupdate") (eq $.SortType "leastupdate")}}
+
+ {{svg "octicon-history" 14}}
+ {{ctx.Locale.Tr "issues.updated" (DateUtils.TimeSince .UpdatedUnix)}}
+
+ {{end}}
diff --git a/tests/integration/issue_test.go b/tests/integration/issue_test.go
index 2e7428a1ac..b47f3fd534 100644
--- a/tests/integration/issue_test.go
+++ b/tests/integration/issue_test.go
@@ -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)()