1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-15 05:08:13 +00:00

Fix context usages (#35348)

This commit is contained in:
wxiaoguang
2025-08-27 19:00:01 +08:00
committed by GitHub
parent da5ce5c8e7
commit e837c998b7
48 changed files with 98 additions and 100 deletions

View File

@@ -414,7 +414,7 @@ func (c *Comment) HTMLURL(ctx context.Context) string {
log.Error("loadRepo(%d): %v", c.Issue.RepoID, err)
return ""
}
return c.Issue.HTMLURL() + c.hashLink(ctx)
return c.Issue.HTMLURL(ctx) + c.hashLink(ctx)
}
// Link formats a relative URL-string to the issue-comment
@@ -483,7 +483,7 @@ func (c *Comment) IssueURL(ctx context.Context) string {
log.Error("loadRepo(%d): %v", c.Issue.RepoID, err)
return ""
}
return c.Issue.HTMLURL()
return c.Issue.HTMLURL(ctx)
}
// PRURL formats a URL-string to the pull-request
@@ -503,7 +503,7 @@ func (c *Comment) PRURL(ctx context.Context) string {
if !c.Issue.IsPull {
return ""
}
return c.Issue.HTMLURL()
return c.Issue.HTMLURL(ctx)
}
// CommentHashTag returns unique hash tag for comment id.

View File

@@ -405,14 +405,14 @@ func (issue *Issue) APIURL(ctx context.Context) string {
}
// HTMLURL returns the absolute URL to this issue.
func (issue *Issue) HTMLURL() string {
func (issue *Issue) HTMLURL(ctx context.Context) string {
var path string
if issue.IsPull {
path = "pulls"
} else {
path = "issues"
}
return fmt.Sprintf("%s/%s/%d", issue.Repo.HTMLURL(), path, issue.Index)
return fmt.Sprintf("%s/%s/%d", issue.Repo.HTMLURL(ctx), path, issue.Index)
}
// Link returns the issue's relative URL.