1
0
Fork 0
forked from forgejo/forgejo

Redirect to project again after editing it (#23326)

A part of https://github.com/go-gitea/gitea/pull/22865

We have edit buttons in projects list page and project view page.
But after user edit a project, it will always redirect to the projects
list page.
This commit is contained in:
yp05327 2023-03-09 23:38:29 +09:00 committed by GitHub
parent 8cadd51bf2
commit e52ac62d8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 4 deletions

View file

@ -233,6 +233,7 @@ func EditProject(ctx *context.Context) {
ctx.Data["title"] = p.Title
ctx.Data["content"] = p.Description
ctx.Data["redirect"] = ctx.FormString("redirect")
ctx.HTML(http.StatusOK, tplProjectsNew)
}
@ -273,7 +274,11 @@ func EditProjectPost(ctx *context.Context) {
}
ctx.Flash.Success(ctx.Tr("repo.projects.edit_success", p.Title))
ctx.Redirect(ctx.Repo.RepoLink + "/projects")
if ctx.FormString("redirect") == "project" {
ctx.Redirect(p.Link())
} else {
ctx.Redirect(ctx.ContextUser.HomeLink() + "/-/projects")
}
}
// ViewProject renders the project board for a project