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 <dev.lh@web.de>
This commit is contained in:
Eekle 2022-05-18 22:36:49 +01:00 committed by GitHub
parent 6a052fba05
commit 260a28d8d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -295,8 +295,9 @@ func CommentTypeIsRef(t CommentType) bool {
// RefCommentHTMLURL returns the HTML URL for the comment that created this reference // RefCommentHTMLURL returns the HTML URL for the comment that created this reference
func (comment *Comment) RefCommentHTMLURL() string { 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 { if comment.RefCommentID == 0 {
return "" return comment.RefIssueHTMLURL()
} }
if err := comment.LoadRefComment(); err != nil { // Silently dropping errors :unamused: if err := comment.LoadRefComment(); err != nil { // Silently dropping errors :unamused:
log.Error("LoadRefComment(%d): %v", comment.RefCommentID, err) log.Error("LoadRefComment(%d): %v", comment.RefCommentID, err)