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

@ -42,7 +42,7 @@ func GetThread(ctx *context.APIContext) {
if n == nil {
return
}
if err := n.LoadAttributes(); err != nil && !issues_model.IsErrCommentNotExist(err) {
if err := n.LoadAttributes(ctx); err != nil && !issues_model.IsErrCommentNotExist(err) {
ctx.InternalServerError(err)
return
}
@ -89,12 +89,12 @@ func ReadThread(ctx *context.APIContext) {
targetStatus = activities_model.NotificationStatusRead
}
notif, err := activities_model.SetNotificationStatus(n.ID, ctx.Doer, targetStatus)
notif, err := activities_model.SetNotificationStatus(ctx, n.ID, ctx.Doer, targetStatus)
if err != nil {
ctx.InternalServerError(err)
return
}
if err = notif.LoadAttributes(); err != nil && !issues_model.IsErrCommentNotExist(err) {
if err = notif.LoadAttributes(ctx); err != nil && !issues_model.IsErrCommentNotExist(err) {
ctx.InternalServerError(err)
return
}
@ -102,7 +102,7 @@ func ReadThread(ctx *context.APIContext) {
}
func getThread(ctx *context.APIContext) *activities_model.Notification {
n, err := activities_model.GetNotificationByID(ctx.ParamsInt64(":id"))
n, err := activities_model.GetNotificationByID(ctx, ctx.ParamsInt64(":id"))
if err != nil {
if db.IsErrNotExist(err) {
ctx.Error(http.StatusNotFound, "GetNotificationByID", err)