From 260a28d8d59b7402653799ef1370f3641483940f Mon Sep 17 00:00:00 2001 From: Eekle <96976531+Eekle@users.noreply.github.com> Date: Wed, 18 May 2022 22:36:49 +0100 Subject: [PATCH] Improved ref comment link when origin is body/title (#19741) * Makes comments in body text/title return the base page URL instead of "" in RefCommentHTMLURL() * Add comment explaining branch Co-authored-by: delvh --- models/issue_xref.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/issue_xref.go b/models/issue_xref.go index c4f0080edd..3c9e67c3f8 100644 --- a/models/issue_xref.go +++ b/models/issue_xref.go @@ -295,8 +295,9 @@ 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 "" + return comment.RefIssueHTMLURL() } if err := comment.LoadRefComment(); err != nil { // Silently dropping errors :unamused: log.Error("LoadRefComment(%d): %v", comment.RefCommentID, err)