summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/issue.go
diff options
context:
space:
mode:
authorRomain <romdum@users.noreply.github.com>2021-10-05 21:21:52 +0200
committerGitHub <noreply@github.com>2021-10-05 21:21:52 +0200
commit167914cf8b1407448c668c53530ef6dc579a89f8 (patch)
tree7bd72c65c70f4102d76631deb1db64158e5f4088 /routers/web/repo/issue.go
parent987152ba408b03fe0b15dd9c72dfd1614b4159fd (diff)
downloadgitea-167914cf8b1407448c668c53530ef6dc579a89f8.tar.gz
gitea-167914cf8b1407448c668c53530ef6dc579a89f8.zip
Redirect on project after issue created (#17211)
close #17011 If user create an issue with button in project view, after issue is created the user is redirect to project view.
Diffstat (limited to 'routers/web/repo/issue.go')
-rw-r--r--routers/web/repo/issue.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 7498830d94..03bdbec80c 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -803,6 +803,9 @@ func NewIssue(ctx *context.Context) {
ctx.Data["Project"] = project
}
+ if len(ctx.Req.URL.Query().Get("project")) > 0 {
+ ctx.Data["redirect_after_creation"] = "project"
+ }
}
RetrieveRepoMetas(ctx, ctx.Repo.Repository, false)
@@ -990,7 +993,11 @@ func NewIssuePost(ctx *context.Context) {
}
log.Trace("Issue created: %d/%d", repo.ID, issue.ID)
- ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + fmt.Sprint(issue.Index))
+ if ctx.FormString("redirect_after_creation") == "project" {
+ ctx.Redirect(ctx.Repo.RepoLink + "/projects/" + fmt.Sprint(form.ProjectID))
+ } else {
+ ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + fmt.Sprint(issue.Index))
+ }
}
// commentTag returns the CommentTag for a comment in/with the given repo, poster and issue