Revert "[GITEA] Make reference URL absolute"

This reverts commit a8ce03660f.
This commit is contained in:
Earl Warren 2024-01-16 13:42:39 +00:00
parent 74652a6c81
commit b856b108e9
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 2 additions and 30 deletions

View file

@ -5,9 +5,9 @@
<div class="menu"> <div class="menu">
{{$referenceUrl := ""}} {{$referenceUrl := ""}}
{{if .issue}} {{if .issue}}
{{$referenceUrl = printf "%s#%s" .ctxData.Issue.HTMLURL .item.HashTag}} {{$referenceUrl = printf "%s#%s" .ctxData.Issue.Link .item.HashTag}}
{{else}} {{else}}
{{$referenceUrl = printf "%s/files#%s" .ctxData.Issue.HTMLURL .item.HashTag}} {{$referenceUrl = printf "%s/files#%s" .ctxData.Issue.Link .item.HashTag}}
{{end}} {{end}}
<div class="item context js-aria-clickable" data-clipboard-text-type="url" data-clipboard-text="{{$referenceUrl}}">{{ctx.Locale.Tr "repo.issues.context.copy_link"}}</div> <div class="item context js-aria-clickable" data-clipboard-text-type="url" data-clipboard-text="{{$referenceUrl}}">{{ctx.Locale.Tr "repo.issues.context.copy_link"}}</div>
{{if and .ctxData.IsSigned (not .ctxData.Repository.IsArchived)}} {{if and .ctxData.IsSigned (not .ctxData.Repository.IsArchived)}}

View file

@ -700,34 +700,6 @@ func TestIssuePinMove(t *testing.T) {
assert.EqualValues(t, newPosition, issue.PinOrder) assert.EqualValues(t, newPosition, issue.PinOrder)
} }
func TestAbsoluteReferenceURL(t *testing.T) {
defer tests.PrepareTestEnv(t)()
session := loginUser(t, "user2")
issue1 := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 1})
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue1.RepoID})
req := NewRequest(t, "GET", fmt.Sprintf("%s/issues/%d", repo.FullName(), issue1.Index))
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
t.Run("Issue", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
referenceURL, ok := htmlDoc.Find(".reference-issue").Attr("data-reference")
assert.True(t, ok)
assert.EqualValues(t, setting.AppURL+"user2/repo1/issues/1#issue-1", referenceURL)
})
t.Run("Comment", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
referenceURL, ok := htmlDoc.Find(`[id^="issuecomment"] .reference-issue`).Attr("data-reference")
assert.True(t, ok)
assert.EqualValues(t, setting.AppURL+"user2/repo1/issues/1#issuecomment-2", referenceURL)
})
}
func TestGetContentHistory(t *testing.T) { func TestGetContentHistory(t *testing.T) {
defer tests.AddFixtures("tests/integration/fixtures/TestGetContentHistory/")() defer tests.AddFixtures("tests/integration/fixtures/TestGetContentHistory/")()
defer tests.PrepareTestEnv(t)() defer tests.PrepareTestEnv(t)()