forked from forgejo/forgejo
Backport #27265 by @JakobDev Part of #27065 This PR touches functions used in templates. As templates are not static typed, errors are harder to find, but I hope I catch it all. I think some tests from other persons do not hurt. Co-authored-by: JakobDev <jakobdev@gmx.de>
This commit is contained in:
parent
84ee02faa7
commit
f13a294b47
66 changed files with 455 additions and 456 deletions
|
@ -142,7 +142,7 @@ func NewProjectPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := project_model.NewProject(&project_model.Project{
|
||||
if err := project_model.NewProject(ctx, &project_model.Project{
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
Title: form.Title,
|
||||
Description: form.Content,
|
||||
|
@ -172,7 +172,7 @@ func ChangeProjectStatus(ctx *context.Context) {
|
|||
}
|
||||
id := ctx.ParamsInt64(":id")
|
||||
|
||||
if err := project_model.ChangeProjectStatusByRepoIDAndID(ctx.Repo.Repository.ID, id, toClose); err != nil {
|
||||
if err := project_model.ChangeProjectStatusByRepoIDAndID(ctx, ctx.Repo.Repository.ID, id, toClose); err != nil {
|
||||
if project_model.IsErrProjectNotExist(err) {
|
||||
ctx.NotFound("", err)
|
||||
} else {
|
||||
|
@ -279,7 +279,7 @@ func EditProjectPost(ctx *context.Context) {
|
|||
|
||||
ctx.Flash.Success(ctx.Tr("repo.projects.edit_success", p.Title))
|
||||
if ctx.FormString("redirect") == "project" {
|
||||
ctx.Redirect(p.Link())
|
||||
ctx.Redirect(p.Link(ctx))
|
||||
} else {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/projects")
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ func DeleteProjectBoard(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := project_model.DeleteBoardByID(ctx.ParamsInt64(":boardID")); err != nil {
|
||||
if err := project_model.DeleteBoardByID(ctx, ctx.ParamsInt64(":boardID")); err != nil {
|
||||
ctx.ServerError("DeleteProjectBoardByID", err)
|
||||
return
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ func AddBoardToProjectPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := project_model.NewBoard(&project_model.Board{
|
||||
if err := project_model.NewBoard(ctx, &project_model.Board{
|
||||
ProjectID: project.ID,
|
||||
Title: form.Title,
|
||||
Color: form.Color,
|
||||
|
@ -565,7 +565,7 @@ func SetDefaultProjectBoard(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := project_model.SetDefaultBoard(project.ID, board.ID); err != nil {
|
||||
if err := project_model.SetDefaultBoard(ctx, project.ID, board.ID); err != nil {
|
||||
ctx.ServerError("SetDefaultBoard", err)
|
||||
return
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ func UnSetDefaultProjectBoard(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := project_model.SetDefaultBoard(project.ID, 0); err != nil {
|
||||
if err := project_model.SetDefaultBoard(ctx, project.ID, 0); err != nil {
|
||||
ctx.ServerError("SetDefaultBoard", err)
|
||||
return
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ func MoveIssues(ctx *context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
if err = project_model.MoveIssuesOnProjectBoard(board, sortedIssueIDs); err != nil {
|
||||
if err = project_model.MoveIssuesOnProjectBoard(ctx, board, sortedIssueIDs); err != nil {
|
||||
ctx.ServerError("MoveIssuesOnProjectBoard", err)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue