mirror of
https://github.com/go-gitea/gitea
synced 2024-11-28 17:54:25 +01:00
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.
This commit is contained in:
parent
987152ba40
commit
167914cf8b
2 changed files with 9 additions and 1 deletions
|
@ -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,8 +993,12 @@ func NewIssuePost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
log.Trace("Issue created: %d/%d", repo.ID, issue.ID)
|
||||
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
|
||||
func commentTag(repo *models.Repository, poster *models.User, issue *models.Issue) (models.CommentTag, error) {
|
||||
|
|
|
@ -236,5 +236,6 @@
|
|||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="redirect_after_creation" value="{{.redirect_after_creation}}">
|
||||
</div>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue