loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'fix: Add `recentupdated` as recognized sort option' (#5613) from gusted/forgejo-add-recentupdated-case into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5613
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>

Gusted 215700fc dfe9bdd1

+44 -7
+13 -1
models/fixtures/repository.yml
··· 91 91 size: 0 92 92 is_fsck_enabled: true 93 93 close_issues_via_commit_in_any_branch: false 94 + created_unix: 1700000001 95 + updated_unix: 1700000001 94 96 95 97 - 96 98 id: 4 ··· 152 154 size: 0 153 155 is_fsck_enabled: true 154 156 close_issues_via_commit_in_any_branch: false 157 + created_unix: 1700000002 158 + updated_unix: 1700000002 155 159 156 160 - 157 161 id: 6 ··· 182 186 size: 0 183 187 is_fsck_enabled: true 184 188 close_issues_via_commit_in_any_branch: false 189 + created_unix: 1710000001 190 + updated_unix: 1710000001 185 191 186 192 - 187 193 id: 7 ··· 212 218 size: 0 213 219 is_fsck_enabled: true 214 220 close_issues_via_commit_in_any_branch: false 221 + created_unix: 1710000003 222 + updated_unix: 1710000003 215 223 216 224 - 217 225 id: 8 ··· 242 250 size: 0 243 251 is_fsck_enabled: true 244 252 close_issues_via_commit_in_any_branch: false 253 + created_unix: 1710000002 254 + updated_unix: 1710000002 245 255 246 256 - 247 257 id: 9 ··· 968 978 size: 0 969 979 is_fsck_enabled: true 970 980 close_issues_via_commit_in_any_branch: false 981 + created_unix: 1700000003 982 + updated_unix: 1700000003 971 983 972 984 - 973 985 id: 33 ··· 1811 1823 template_id: 0 1812 1824 size: 0 1813 1825 is_fsck_enabled: true 1814 - close_issues_via_commit_in_any_branch: false 1826 + close_issues_via_commit_in_any_branch: false
+4 -4
models/organization/org_test.go
··· 299 299 require.NoError(t, err) 300 300 assert.Equal(t, expectedRepoIDs, repoIDs) 301 301 } 302 - testSuccess(2, []int64{3, 5, 32}) 303 - testSuccess(4, []int64{3, 32}) 302 + testSuccess(2, []int64{32, 5, 3}) 303 + testSuccess(4, []int64{32, 3}) 304 304 } 305 305 306 306 func TestAccessibleReposEnv_Repos(t *testing.T) { ··· 318 318 } 319 319 assert.Equal(t, expectedRepos, repos) 320 320 } 321 - testSuccess(2, []int64{3, 5, 32}) 322 - testSuccess(4, []int64{3, 32}) 321 + testSuccess(2, []int64{32, 5, 3}) 322 + testSuccess(4, []int64{32, 3}) 323 323 } 324 324 325 325 func TestAccessibleReposEnv_MirrorRepos(t *testing.T) {
+1
models/repo/search.go
··· 36 36 var OrderByFlatMap = map[string]db.SearchOrderBy{ 37 37 "newest": OrderByMap["desc"]["created"], 38 38 "oldest": OrderByMap["asc"]["created"], 39 + "recentupdate": OrderByMap["desc"]["updated"], 39 40 "leastupdate": OrderByMap["asc"]["updated"], 40 41 "reversealphabetically": OrderByMap["desc"]["alpha"], 41 42 "alphabetically": OrderByMap["asc"]["alpha"],
+1 -2
tests/integration/last_updated_time_test.go
··· 16 16 user := "user2" 17 17 session := loginUser(t, user) 18 18 19 - req := NewRequest(t, "GET", path.Join("explore", "repos")) 19 + req := NewRequest(t, "GET", "/explore/repos?q=repo1") 20 20 resp := session.MakeRequest(t, req, http.StatusOK) 21 21 doc := NewHTMLParser(t, resp.Body) 22 22 node := doc.doc.Find(".flex-item-body").First() 23 - 24 23 { 25 24 buf := "" 26 25 findTextNonNested(t, node, &buf)
+1
tests/integration/org_test.go
··· 28 28 users = []string{"user1", "user2"} 29 29 cases = map[string][]string{ 30 30 "alphabetically": {"repo21", "repo3", "repo5"}, 31 + "recentupdate": {"repo21", "repo5", "repo3"}, 31 32 "reversealphabetically": {"repo5", "repo3", "repo21"}, 32 33 } 33 34 )
+24
tests/integration/user_test.go
··· 812 812 assert.True(t, called) 813 813 }) 814 814 } 815 + 816 + func TestUserRepos(t *testing.T) { 817 + defer tests.PrepareTestEnv(t)() 818 + 819 + cases := map[string][]string{ 820 + "alphabetically": {"repo6", "repo7", "repo8"}, 821 + "recentupdate": {"repo7", "repo8", "repo6"}, 822 + "reversealphabetically": {"repo8", "repo7", "repo6"}, 823 + } 824 + 825 + session := loginUser(t, "user10") 826 + for sortBy, repos := range cases { 827 + req := NewRequest(t, "GET", "/user10?sort="+sortBy) 828 + resp := session.MakeRequest(t, req, http.StatusOK) 829 + 830 + htmlDoc := NewHTMLParser(t, resp.Body) 831 + 832 + sel := htmlDoc.doc.Find("a.name") 833 + assert.Len(t, repos, len(sel.Nodes)) 834 + for i := 0; i < len(repos); i++ { 835 + assert.EqualValues(t, repos[i], strings.TrimSpace(sel.Eq(i).Text())) 836 + } 837 + } 838 + }