1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Renamed ctx.User to ctx.Doer. (#19161)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
KN4CK3R
2022-03-22 08:03:22 +01:00
committed by GitHub
parent 5495ba7660
commit 80fd25524e
129 changed files with 881 additions and 881 deletions

View File

@@ -56,7 +56,7 @@ func StartIssueStopwatch(ctx *context.APIContext) {
return
}
if err := models.CreateIssueStopwatch(db.DefaultContext, ctx.User, issue); err != nil {
if err := models.CreateIssueStopwatch(db.DefaultContext, ctx.Doer, issue); err != nil {
ctx.Error(http.StatusInternalServerError, "CreateOrStopIssueStopwatch", err)
return
}
@@ -105,7 +105,7 @@ func StopIssueStopwatch(ctx *context.APIContext) {
return
}
if err := models.FinishIssueStopwatch(db.DefaultContext, ctx.User, issue); err != nil {
if err := models.FinishIssueStopwatch(db.DefaultContext, ctx.Doer, issue); err != nil {
ctx.Error(http.StatusInternalServerError, "CreateOrStopIssueStopwatch", err)
return
}
@@ -154,7 +154,7 @@ func DeleteIssueStopwatch(ctx *context.APIContext) {
return
}
if err := models.CancelStopwatch(ctx.User, issue); err != nil {
if err := models.CancelStopwatch(ctx.Doer, issue); err != nil {
ctx.Error(http.StatusInternalServerError, "CancelStopwatch", err)
return
}
@@ -179,12 +179,12 @@ func prepareIssueStopwatch(ctx *context.APIContext, shouldExist bool) (*models.I
return nil, errors.New("Unable to write to PRs")
}
if !ctx.Repo.CanUseTimetracker(issue, ctx.User) {
if !ctx.Repo.CanUseTimetracker(issue, ctx.Doer) {
ctx.Status(http.StatusForbidden)
return nil, errors.New("Cannot use time tracker")
}
if models.StopwatchExists(ctx.User.ID, issue.ID) != shouldExist {
if models.StopwatchExists(ctx.Doer.ID, issue.ID) != shouldExist {
if shouldExist {
ctx.Error(http.StatusConflict, "StopwatchExists", "cannot stop/cancel a non existent stopwatch")
err = errors.New("cannot stop/cancel a non existent stopwatch")
@@ -220,13 +220,13 @@ func GetStopwatches(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/StopWatchList"
sws, err := models.GetUserStopwatches(ctx.User.ID, utils.GetListOptions(ctx))
sws, err := models.GetUserStopwatches(ctx.Doer.ID, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserStopwatches", err)
return
}
count, err := models.CountUserStopwatches(ctx.User.ID)
count, err := models.CountUserStopwatches(ctx.Doer.ID)
if err != nil {
ctx.InternalServerError(err)
return