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.

feat: set fuzzy as default for issue search (#5270)

Closes #5225

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5270
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>

authored by

Shiny Nematoda
Shiny Nematoda
and committed by
0ko
6178a46f 630595a7

+15 -13
+1 -1
routers/web/repo/issue.go
··· 203 203 keyword = "" 204 204 } 205 205 206 - isFuzzy := ctx.FormBool("fuzzy") 206 + isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true) 207 207 208 208 var mileIDs []int64 209 209 if milestoneID > 0 || milestoneID == db.NoConditionID { // -1 to get those issues which have no any milestone assigned
+1 -1
routers/web/user/home.go
··· 448 448 User: ctx.Doer, 449 449 } 450 450 451 - isFuzzy := ctx.FormBool("fuzzy") 451 + isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true) 452 452 453 453 // Search all repositories which 454 454 //
+13 -11
tests/integration/issue_test.go
··· 146 146 assert.EqualValues(t, 0, issuesSelection.Length()) 147 147 148 148 // should match as 'first' when fuzzy seaeching is enabled 149 - req = NewRequestf(t, "GET", "%s/issues?q=%st&fuzzy=true", repo.Link(), keyword) 150 - resp = MakeRequest(t, req, http.StatusOK) 151 - htmlDoc = NewHTMLParser(t, resp.Body) 152 - issuesSelection = getIssuesSelection(t, htmlDoc) 153 - assert.EqualValues(t, 1, issuesSelection.Length()) 154 - issuesSelection.Each(func(_ int, selection *goquery.Selection) { 155 - issue := getIssue(t, repo.ID, selection) 156 - assert.False(t, issue.IsClosed) 157 - assert.False(t, issue.IsPull) 158 - assertMatch(t, issue, keyword) 159 - }) 149 + for _, fmt := range []string{"%s/issues?q=%st&fuzzy=true", "%s/issues?q=%st"} { 150 + req = NewRequestf(t, "GET", fmt, repo.Link(), keyword) 151 + resp = MakeRequest(t, req, http.StatusOK) 152 + htmlDoc = NewHTMLParser(t, resp.Body) 153 + issuesSelection = getIssuesSelection(t, htmlDoc) 154 + assert.EqualValues(t, 1, issuesSelection.Length()) 155 + issuesSelection.Each(func(_ int, selection *goquery.Selection) { 156 + issue := getIssue(t, repo.ID, selection) 157 + assert.False(t, issue.IsClosed) 158 + assert.False(t, issue.IsPull) 159 + assertMatch(t, issue, keyword) 160 + }) 161 + } 160 162 } 161 163 162 164 func TestViewIssuesSearchOptions(t *testing.T) {