Skip to content

Commit 99e3274

Browse files
committed
Do not show issue context popup on external issues
The issues pop-up context cannot work for external issues - therefore do not show these. Fix go-gitea#17047 Signed-off-by: Andrew Thornton <[email protected]>
1 parent e2f0ab3 commit 99e3274

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

modules/markup/html.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ func issueIndexPatternProcessor(ctx *RenderContext, node *html.Node) {
830830
reftext := node.Data[ref.RefLocation.Start:ref.RefLocation.End]
831831
if exttrack && !ref.IsPull {
832832
ctx.Metas["index"] = ref.Issue
833-
link = createLink(com.Expand(ctx.Metas["format"], ctx.Metas), reftext, "ref-issue")
833+
link = createLink(com.Expand(ctx.Metas["format"], ctx.Metas), reftext, "ref-issue ref-external-issue")
834834
} else {
835835
// Path determines the type of link that will be rendered. It's unknown at this point whether
836836
// the linked item is actually a PR or an issue. Luckily it's of no real consequence because

modules/markup/sanitizer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func createDefaultPolicy() *bluemonday.Policy {
6666
}
6767

6868
// Allow classes for anchors
69-
policy.AllowAttrs("class").Matching(regexp.MustCompile(`ref-issue`)).OnElements("a")
69+
policy.AllowAttrs("class").Matching(regexp.MustCompile(`ref-issue( ref-external-issue)?`)).OnElements("a")
7070

7171
// Allow classes for task lists
7272
policy.AllowAttrs("class").Matching(regexp.MustCompile(`task-list-item`)).OnElements("li")

web_src/js/features/contextpopup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export default function initContextPopups() {
77
if (!refIssues.length) return;
88

99
refIssues.each(function () {
10+
if ($(this).hasClass('ref-external-issue')) {
11+
return;
12+
}
1013
const [index, _issues, repo, owner] = $(this).attr('href').replace(/[#?].*$/, '').split('/').reverse();
1114

1215
const el = document.createElement('div');

0 commit comments

Comments
 (0)