mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-15 00:01:25 -04:00
Compare commits
2 Commits
fd2c250b52
...
263d06f616
Author | SHA1 | Date | |
---|---|---|---|
|
263d06f616 | ||
|
6dc16c1154 |
@ -358,12 +358,19 @@ func postProcess(ctx *RenderContext, procs []processor, input io.Reader, output
|
|||||||
}
|
}
|
||||||
|
|
||||||
func visitNode(ctx *RenderContext, procs, textProcs []processor, node *html.Node) {
|
func visitNode(ctx *RenderContext, procs, textProcs []processor, node *html.Node) {
|
||||||
// Add user-content- to IDs if they don't already have them
|
// Add user-content- to IDs and "#" links if they don't already have them
|
||||||
for idx, attr := range node.Attr {
|
for idx, attr := range node.Attr {
|
||||||
if attr.Key == "id" && !(strings.HasPrefix(attr.Val, "user-content-") || blackfridayExtRegex.MatchString(attr.Val)) {
|
val := strings.TrimPrefix(attr.Val, "#")
|
||||||
|
notHasPrefix := !(strings.HasPrefix(val, "user-content-") || blackfridayExtRegex.MatchString(val))
|
||||||
|
|
||||||
|
if attr.Key == "id" && notHasPrefix {
|
||||||
node.Attr[idx].Val = "user-content-" + attr.Val
|
node.Attr[idx].Val = "user-content-" + attr.Val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if attr.Key == "href" && strings.HasPrefix(attr.Val, "#") && notHasPrefix {
|
||||||
|
node.Attr[idx].Val = "#user-content-" + val
|
||||||
|
}
|
||||||
|
|
||||||
if attr.Key == "class" && attr.Val == "emoji" {
|
if attr.Key == "class" && attr.Val == "emoji" {
|
||||||
textProcs = nil
|
textProcs = nil
|
||||||
}
|
}
|
||||||
|
@ -1381,7 +1381,7 @@ func CleanUpPullRequest(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func deleteBranch(ctx *context.Context, pr *issues_model.PullRequest, gitRepo *git.Repository) {
|
func deleteBranch(ctx *context.Context, pr *issues_model.PullRequest, gitRepo *git.Repository) {
|
||||||
fullBranchName := pr.HeadRepo.Owner.Name + "/" + pr.HeadBranch
|
fullBranchName := pr.HeadRepo.FullName() + ":" + pr.HeadBranch
|
||||||
if err := repo_service.DeleteBranch(ctx.Doer, pr.HeadRepo, gitRepo, pr.HeadBranch); err != nil {
|
if err := repo_service.DeleteBranch(ctx.Doer, pr.HeadRepo, gitRepo, pr.HeadBranch); err != nil {
|
||||||
switch {
|
switch {
|
||||||
case git.IsErrBranchNotExist(err):
|
case git.IsErrBranchNotExist(err):
|
||||||
|
@ -187,7 +187,7 @@ func TestPullCleanUpAfterMerge(t *testing.T) {
|
|||||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
resultMsg := htmlDoc.doc.Find(".ui.message>p").Text()
|
resultMsg := htmlDoc.doc.Find(".ui.message>p").Text()
|
||||||
|
|
||||||
assert.EqualValues(t, "Branch 'user1/feature/test' has been deleted.", resultMsg)
|
assert.EqualValues(t, "Branch 'user1/repo1:feature/test' has been deleted.", resultMsg)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user