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:
parent
fefdb7ffd1
commit
044c754ea5
148 changed files with 1411 additions and 1564 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue