forked from forgejo/forgejo
Merge pull request 'Add rel="nofollow" to issue filter links' (#2367) from algernon/forgejo:b/issues/nofollow into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2367 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
commit
0c0b87ec1a
2 changed files with 46 additions and 28 deletions
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2024 The Forgejo Authors c/o Codeberg e.V.. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package integration
|
||||
|
@ -797,3 +798,20 @@ func TestCommitRefComment(t *testing.T) {
|
|||
assert.Contains(t, event, "referenced this issue")
|
||||
})
|
||||
}
|
||||
|
||||
func TestIssueFilterNoFollow(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo1/issues")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
// Check that every link in the filter list has rel="nofollow".
|
||||
filterLinks := htmlDoc.Find(".issue-list-toolbar-right a[href*=\"/issues?q=\"]")
|
||||
assert.True(t, filterLinks.Length() > 0)
|
||||
filterLinks.Each(func(i int, link *goquery.Selection) {
|
||||
rel, has := link.Attr("rel")
|
||||
assert.True(t, has)
|
||||
assert.Equal(t, "nofollow", rel)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue