diff --git a/modules/markup/html.go b/modules/markup/html.go index 2c6773bce..1c73f03df 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -636,11 +636,11 @@ func fullIssuePatternProcessor(ctx *postProcessCtx, node *html.Node) { if matchOrg == ctx.metas["user"] && matchRepo == ctx.metas["repo"] { // TODO if m[4]:m[5] is not nil, then link is to a comment, // and we should indicate that in the text somehow - replaceContent(node, m[0], m[1], createLink(link, id, "issue")) + replaceContent(node, m[0], m[1], createLink(link, id, "ref-issue")) } else { orgRepoID := matchOrg + "/" + matchRepo + id - replaceContent(node, m[0], m[1], createLink(link, orgRepoID, "issue")) + replaceContent(node, m[0], m[1], createLink(link, orgRepoID, "ref-issue")) } } @@ -676,7 +676,7 @@ func issueIndexPatternProcessor(ctx *postProcessCtx, node *html.Node) { reftext := node.Data[ref.RefLocation.Start:ref.RefLocation.End] if exttrack && !ref.IsPull { ctx.metas["index"] = ref.Issue - link = createLink(com.Expand(ctx.metas["format"], ctx.metas), reftext, "issue") + link = createLink(com.Expand(ctx.metas["format"], ctx.metas), reftext, "ref-issue") } else { // Path determines the type of link that will be rendered. It's unknown at this point whether // the linked item is actually a PR or an issue. Luckily it's of no real consequence because @@ -686,9 +686,9 @@ func issueIndexPatternProcessor(ctx *postProcessCtx, node *html.Node) { path = "pulls" } if ref.Owner == "" { - link = createLink(util.URLJoin(setting.AppURL, ctx.metas["user"], ctx.metas["repo"], path, ref.Issue), reftext, "issue") + link = createLink(util.URLJoin(setting.AppURL, ctx.metas["user"], ctx.metas["repo"], path, ref.Issue), reftext, "ref-issue") } else { - link = createLink(util.URLJoin(setting.AppURL, ref.Owner, ref.Name, path, ref.Issue), reftext, "issue") + link = createLink(util.URLJoin(setting.AppURL, ref.Owner, ref.Name, path, ref.Issue), reftext, "ref-issue") } } diff --git a/modules/markup/html_internal_test.go b/modules/markup/html_internal_test.go index 2746dec2c..7e4bb6f22 100644 --- a/modules/markup/html_internal_test.go +++ b/modules/markup/html_internal_test.go @@ -106,13 +106,13 @@ func TestRender_IssueIndexPattern2(t *testing.T) { links := make([]interface{}, len(indices)) for i, index := range indices { - links[i] = numericIssueLink(util.URLJoin(setting.AppSubURL, path), "issue", index, marker) + links[i] = numericIssueLink(util.URLJoin(setting.AppSubURL, path), "ref-issue", index, marker) } expectedNil := fmt.Sprintf(expectedFmt, links...) testRenderIssueIndexPattern(t, s, expectedNil, &postProcessCtx{metas: localMetas}) for i, index := range indices { - links[i] = numericIssueLink(prefix, "issue", index, marker) + links[i] = numericIssueLink(prefix, "ref-issue", index, marker) } expectedNum := fmt.Sprintf(expectedFmt, links...) testRenderIssueIndexPattern(t, s, expectedNum, &postProcessCtx{metas: numericMetas}) @@ -178,7 +178,7 @@ func TestRender_IssueIndexPattern4(t *testing.T) { test := func(s, expectedFmt string, names ...string) { links := make([]interface{}, len(names)) for i, name := range names { - links[i] = alphanumIssueLink("https://someurl.com/someUser/someRepo/", "issue", name) + links[i] = alphanumIssueLink("https://someurl.com/someUser/someRepo/", "ref-issue", name) } expected := fmt.Sprintf(expectedFmt, links...) testRenderIssueIndexPattern(t, s, expected, &postProcessCtx{metas: alphanumericMetas}) @@ -217,7 +217,7 @@ func TestRender_AutoLink(t *testing.T) { // render valid issue URLs test(util.URLJoin(setting.AppSubURL, "issues", "3333"), - numericIssueLink(util.URLJoin(setting.AppSubURL, "issues"), "issue", 3333, "#")) + numericIssueLink(util.URLJoin(setting.AppSubURL, "issues"), "ref-issue", 3333, "#")) // render valid commit URLs tmp := util.URLJoin(AppSubURL, "commit", "d8a994ef243349f321568f9e36d5c3f444b99cae") @@ -248,11 +248,11 @@ func TestRender_FullIssueURLs(t *testing.T) { test("Here is a link https://git.osgeo.org/gogs/postgis/postgis/pulls/6", "Here is a link https://git.osgeo.org/gogs/postgis/postgis/pulls/6") test("Look here http://localhost:3000/person/repo/issues/4", - `Look here person/repo#4`) + `Look here person/repo#4`) test("http://localhost:3000/person/repo/issues/4#issuecomment-1234", - `person/repo#4`) + `person/repo#4`) test("http://localhost:3000/gogits/gogs/issues/4", - `#4`) + `#4`) } func TestRegExp_sha1CurrentPattern(t *testing.T) { diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index 91ef320b4..45145b402 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -58,10 +58,10 @@ func TestRender_CrossReferences(t *testing.T) { test( "gogits/gogs#12345", - `
`) + ``) test( "go-gitea/gitea#12345", - ``) + ``) test( "/home/gitea/go-gitea/gitea#12345", `/home/gitea/go-gitea/gitea#12345
`) diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go index 53772ee44..b2cf52996 100644 --- a/modules/markup/markdown/markdown_test.go +++ b/modules/markup/markdown/markdown_test.go @@ -105,8 +105,8 @@ func testAnswers(baseURLContent, baseURLImages string) []string {See commit 65f1bf27bc
Ideas and codes
${labels}
`; + } + + let octicon; + if (issue.pull_request !== null) { + if (issue.state === 'open') { + octicon = 'green octicon-git-pull-request'; // Open PR + } else if (issue.pull_request.merged === true) { + octicon = 'purple octicon-git-merge'; // Merged PR + } else { + octicon = 'red octicon-git-pull-request'; // Closed PR + } + } else if (issue.state === 'open') { + octicon = 'green octicon-issue-opened'; // Open Issue + } else { + octicon = 'red octicon-issue-closed'; // Closed Issue + } + + $element.popup({ + variation: 'wide', + delay: { + show: 250 + }, + html: ` +${issue.repository.full_name} on ${createdAt}
+${issue.title} #${index}
+${body}
+ ${labels} +