From 1698b92bcbef2365b018df4017ae5a8e4ec664ff Mon Sep 17 00:00:00 2001 From: Eekle <96976531+Eekle@users.noreply.github.com> Date: Wed, 18 May 2022 10:43:38 +0100 Subject: [PATCH 1/2] Makes comments in body text/title return the base page URL instead of "" in RefCommentHTMLURL() --- models/issue_xref.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/issue_xref.go b/models/issue_xref.go index c4f0080edd06a..4f0f4a60a21e9 100644 --- a/models/issue_xref.go +++ b/models/issue_xref.go @@ -296,7 +296,7 @@ func CommentTypeIsRef(t CommentType) bool { // RefCommentHTMLURL returns the HTML URL for the comment that created this reference func (comment *Comment) RefCommentHTMLURL() string { if comment.RefCommentID == 0 { - return "" + return comment.RefIssueHTMLURL() } if err := comment.LoadRefComment(); err != nil { // Silently dropping errors :unamused: log.Error("LoadRefComment(%d): %v", comment.RefCommentID, err) From f17f8640aff9e86c4139bca8d2d8c168b641f0a6 Mon Sep 17 00:00:00 2001 From: Eekle <96976531+Eekle@users.noreply.github.com> Date: Wed, 18 May 2022 19:43:43 +0100 Subject: [PATCH 2/2] Add comment explaining branch Co-authored-by: delvh --- models/issue_xref.go | 1 + 1 file changed, 1 insertion(+) diff --git a/models/issue_xref.go b/models/issue_xref.go index 4f0f4a60a21e9..3c9e67c3f86a8 100644 --- a/models/issue_xref.go +++ b/models/issue_xref.go @@ -295,6 +295,7 @@ func CommentTypeIsRef(t CommentType) bool { // RefCommentHTMLURL returns the HTML URL for the comment that created this reference func (comment *Comment) RefCommentHTMLURL() string { + // Edge case for when the reference is inside the title or the description of the referring issue if comment.RefCommentID == 0 { return comment.RefIssueHTMLURL() }