mirror of
https://github.com/go-gitea/gitea
synced 2025-08-29 12:58:29 +00:00
Fix context usages (#35348)
This commit is contained in:
@@ -66,7 +66,7 @@ func toIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Iss
|
||||
return &api.Issue{}
|
||||
}
|
||||
apiIssue.URL = issue.APIURL(ctx)
|
||||
apiIssue.HTMLURL = issue.HTMLURL()
|
||||
apiIssue.HTMLURL = issue.HTMLURL(ctx)
|
||||
if err := issue.LoadLabels(ctx); err != nil {
|
||||
return &api.Issue{}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ func toIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Iss
|
||||
apiIssue.PullRequest.Merged = issue.PullRequest.MergedUnix.AsTimePtr()
|
||||
}
|
||||
// Add pr's html url
|
||||
apiIssue.PullRequest.HTMLURL = issue.HTMLURL()
|
||||
apiIssue.PullRequest.HTMLURL = issue.HTMLURL(ctx)
|
||||
}
|
||||
}
|
||||
if issue.DeadlineUnix != 0 {
|
||||
|
@@ -40,7 +40,7 @@ func ToNotificationThread(ctx context.Context, n *activities_model.Notification)
|
||||
if n.Issue != nil {
|
||||
result.Subject.Title = n.Issue.Title
|
||||
result.Subject.URL = n.Issue.APIURL(ctx)
|
||||
result.Subject.HTMLURL = n.Issue.HTMLURL()
|
||||
result.Subject.HTMLURL = n.Issue.HTMLURL(ctx)
|
||||
result.Subject.State = n.Issue.State()
|
||||
comment, err := n.Issue.GetLastComment(ctx)
|
||||
if err == nil && comment != nil {
|
||||
@@ -53,7 +53,7 @@ func ToNotificationThread(ctx context.Context, n *activities_model.Notification)
|
||||
if n.Issue != nil {
|
||||
result.Subject.Title = n.Issue.Title
|
||||
result.Subject.URL = n.Issue.APIURL(ctx)
|
||||
result.Subject.HTMLURL = n.Issue.HTMLURL()
|
||||
result.Subject.HTMLURL = n.Issue.HTMLURL(ctx)
|
||||
result.Subject.State = n.Issue.State()
|
||||
comment, err := n.Issue.GetLastComment(ctx)
|
||||
if err == nil && comment != nil {
|
||||
|
@@ -35,7 +35,7 @@ func ToPackage(ctx context.Context, pd *packages.PackageDescriptor, doer *user_m
|
||||
Name: pd.Package.Name,
|
||||
Version: pd.Version.Version,
|
||||
CreatedAt: pd.Version.CreatedUnix.AsTime(),
|
||||
HTMLURL: pd.VersionHTMLURL(),
|
||||
HTMLURL: pd.VersionHTMLURL(ctx),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,7 @@ func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *u
|
||||
|
||||
apiPullRequest := &api.PullRequest{
|
||||
ID: pr.ID,
|
||||
URL: pr.Issue.HTMLURL(),
|
||||
URL: pr.Issue.HTMLURL(ctx),
|
||||
Index: pr.Index,
|
||||
Poster: apiIssue.Poster,
|
||||
Title: apiIssue.Title,
|
||||
@@ -87,7 +87,7 @@ func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *u
|
||||
IsLocked: apiIssue.IsLocked,
|
||||
Comments: apiIssue.Comments,
|
||||
ReviewComments: pr.GetReviewCommentsCount(ctx),
|
||||
HTMLURL: pr.Issue.HTMLURL(),
|
||||
HTMLURL: pr.Issue.HTMLURL(ctx),
|
||||
DiffURL: pr.Issue.DiffURL(),
|
||||
PatchURL: pr.Issue.PatchURL(),
|
||||
HasMerged: pr.HasMerged,
|
||||
@@ -348,7 +348,7 @@ func ToAPIPullRequests(ctx context.Context, baseRepo *repo_model.Repository, prs
|
||||
|
||||
apiPullRequest := &api.PullRequest{
|
||||
ID: pr.ID,
|
||||
URL: pr.Issue.HTMLURL(),
|
||||
URL: pr.Issue.HTMLURL(ctx),
|
||||
Index: pr.Index,
|
||||
Poster: apiIssue.Poster,
|
||||
Title: apiIssue.Title,
|
||||
@@ -362,7 +362,7 @@ func ToAPIPullRequests(ctx context.Context, baseRepo *repo_model.Repository, prs
|
||||
IsLocked: apiIssue.IsLocked,
|
||||
Comments: apiIssue.Comments,
|
||||
ReviewComments: reviewCounts[pr.IssueID],
|
||||
HTMLURL: pr.Issue.HTMLURL(),
|
||||
HTMLURL: pr.Issue.HTMLURL(ctx),
|
||||
DiffURL: pr.Issue.DiffURL(),
|
||||
PatchURL: pr.Issue.PatchURL(),
|
||||
HasMerged: pr.HasMerged,
|
||||
|
@@ -34,7 +34,7 @@ func ToPullReview(ctx context.Context, r *issues_model.Review, doer *user_model.
|
||||
Submitted: r.CreatedUnix.AsTime(),
|
||||
Updated: r.UpdatedUnix.AsTime(),
|
||||
HTMLURL: r.HTMLURL(ctx),
|
||||
HTMLPullURL: r.Issue.HTMLURL(),
|
||||
HTMLPullURL: r.Issue.HTMLURL(ctx),
|
||||
}
|
||||
|
||||
if r.ReviewerTeam != nil {
|
||||
@@ -105,7 +105,7 @@ func ToPullReviewCommentList(ctx context.Context, review *issues_model.Review, d
|
||||
OrigCommitID: comment.OldRef,
|
||||
DiffHunk: patch2diff(comment.Patch),
|
||||
HTMLURL: comment.HTMLURL(ctx),
|
||||
HTMLPullURL: review.Issue.HTMLURL(),
|
||||
HTMLPullURL: review.Issue.HTMLURL(ctx),
|
||||
}
|
||||
|
||||
if comment.Line < 0 {
|
||||
|
@@ -53,7 +53,7 @@ func toUser(ctx context.Context, user *user_model.User, signed, authed bool) *ap
|
||||
FullName: user.FullName,
|
||||
Email: user.GetPlaceholderEmail(),
|
||||
AvatarURL: user.AvatarLink(ctx),
|
||||
HTMLURL: user.HTMLURL(),
|
||||
HTMLURL: user.HTMLURL(ctx),
|
||||
Created: user.CreatedUnix.AsTime(),
|
||||
Restricted: user.IsRestricted,
|
||||
Location: user.Location,
|
||||
|
Reference in New Issue
Block a user