Skip to content

Commit

Permalink
Improved ref comment link when origin is body/title (go-gitea#19741)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
2 people authored and AbdulrhmnGhanem committed Aug 23, 2022
1 parent c971e5a commit 40928c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/issue_xref.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 40928c4

Please sign in to comment.