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.

Fix incorrect menu/link on webhook edit page (#29709)

Fix #29699

---------

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 2da13675c0cfdc531044553636c3b74f2fda3eb4)

authored by

yp05327
silverwind
and committed by
Earl Warren
2da0628f 071d871d

+42
+1
routers/web/repo/setting/webhook.go
··· 616 616 return nil, nil 617 617 } 618 618 ctx.Data["BaseLink"] = orCtx.Link 619 + ctx.Data["BaseLinkNew"] = orCtx.LinkNew 619 620 620 621 var w *webhook.Webhook 621 622 if orCtx.RepoID > 0 {
+41
tests/integration/repo_webhook_test.go
··· 1 + // Copyright 2024 The Gitea Authors. All rights reserved. 2 + // SPDX-License-Identifier: MIT 3 + 4 + package integration 5 + 6 + import ( 7 + "net/http" 8 + "strings" 9 + "testing" 10 + 11 + "code.gitea.io/gitea/tests" 12 + 13 + "github.com/PuerkitoBio/goquery" 14 + "github.com/stretchr/testify/assert" 15 + ) 16 + 17 + func TestNewWebHookLink(t *testing.T) { 18 + defer tests.PrepareTestEnv(t)() 19 + session := loginUser(t, "user2") 20 + 21 + baseurl := "/user2/repo1/settings/hooks" 22 + tests := []string{ 23 + // webhook list page 24 + baseurl, 25 + // new webhook page 26 + baseurl + "/gitea/new", 27 + // edit webhook page 28 + baseurl + "/1", 29 + } 30 + 31 + for _, url := range tests { 32 + resp := session.MakeRequest(t, NewRequest(t, "GET", url), http.StatusOK) 33 + htmlDoc := NewHTMLParser(t, resp.Body) 34 + menus := htmlDoc.doc.Find(".ui.top.attached.header .ui.dropdown .menu a") 35 + menus.Each(func(i int, menu *goquery.Selection) { 36 + url, exist := menu.Attr("href") 37 + assert.True(t, exist) 38 + assert.True(t, strings.HasPrefix(url, baseurl)) 39 + }) 40 + } 41 + }