aboutsummaryrefslogtreecommitdiffstats
path: root/modules/convert/status.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/convert/status.go')
-rw-r--r--modules/convert/status.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/convert/status.go b/modules/convert/status.go
index 5eb38ad063..5fcf04074f 100644
--- a/modules/convert/status.go
+++ b/modules/convert/status.go
@@ -4,13 +4,15 @@
package convert
import (
+ "context"
+
git_model "code.gitea.io/gitea/models/git"
user_model "code.gitea.io/gitea/models/user"
api "code.gitea.io/gitea/modules/structs"
)
// ToCommitStatus converts git_model.CommitStatus to api.CommitStatus
-func ToCommitStatus(status *git_model.CommitStatus) *api.CommitStatus {
+func ToCommitStatus(ctx context.Context, status *git_model.CommitStatus) *api.CommitStatus {
apiStatus := &api.CommitStatus{
Created: status.CreatedUnix.AsTime(),
Updated: status.CreatedUnix.AsTime(),
@@ -23,7 +25,7 @@ func ToCommitStatus(status *git_model.CommitStatus) *api.CommitStatus {
}
if status.CreatorID != 0 {
- creator, _ := user_model.GetUserByID(status.CreatorID)
+ creator, _ := user_model.GetUserByID(ctx, status.CreatorID)
apiStatus.Creator = ToUser(creator, nil)
}
@@ -31,7 +33,7 @@ func ToCommitStatus(status *git_model.CommitStatus) *api.CommitStatus {
}
// ToCombinedStatus converts List of CommitStatus to a CombinedStatus
-func ToCombinedStatus(statuses []*git_model.CommitStatus, repo *api.Repository) *api.CombinedStatus {
+func ToCombinedStatus(ctx context.Context, statuses []*git_model.CommitStatus, repo *api.Repository) *api.CombinedStatus {
if len(statuses) == 0 {
return nil
}
@@ -45,7 +47,7 @@ func ToCombinedStatus(statuses []*git_model.CommitStatus, repo *api.Repository)
retStatus.Statuses = make([]*api.CommitStatus, 0, len(statuses))
for _, status := range statuses {
- retStatus.Statuses = append(retStatus.Statuses, ToCommitStatus(status))
+ retStatus.Statuses = append(retStatus.Statuses, ToCommitStatus(ctx, status))
if status.State.NoBetterThan(retStatus.State) {
retStatus.State = status.State
}