Add context.Context to more methods (#21546)

This PR adds a context parameter to a bunch of methods. Some helper
`xxxCtx()` methods got replaced with the normal name now.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
KN4CK3R 2022-11-19 09:12:33 +01:00 committed by GitHub
parent fefdb7ffd1
commit 044c754ea5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
148 changed files with 1411 additions and 1564 deletions

View file

@ -139,7 +139,7 @@ func ListTrackedTimes(ctx *context.APIContext) {
}
ctx.SetTotalCountHeader(count)
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(trackedTimes))
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
}
// AddTime add time manual to the given issue
@ -224,7 +224,7 @@ func AddTime(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
ctx.JSON(http.StatusOK, convert.ToTrackedTime(trackedTime))
ctx.JSON(http.StatusOK, convert.ToTrackedTime(ctx, trackedTime))
}
// ResetIssueTime reset time manual to the given issue
@ -448,7 +448,7 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(trackedTimes))
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
}
// ListTrackedTimesByRepository lists all tracked times of the repository
@ -558,7 +558,7 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
}
ctx.SetTotalCountHeader(count)
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(trackedTimes))
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
}
// ListMyTrackedTimes lists all tracked times of the current user
@ -620,5 +620,5 @@ func ListMyTrackedTimes(ctx *context.APIContext) {
}
ctx.SetTotalCountHeader(count)
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(trackedTimes))
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
}