Skip to content
15 changes: 12 additions & 3 deletions routers/web/repo/issue_new.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,17 @@ func NewIssuePost(ctx *context.Context) {

log.Trace("Issue created: %d/%d", repo.ID, issue.ID)
if ctx.FormString("redirect_after_creation") == "project" && projectID > 0 {
ctx.JSONRedirect(ctx.Repo.RepoLink + "/projects/" + strconv.FormatInt(projectID, 10))
} else {
ctx.JSONRedirect(issue.Link())
project, err := project_model.GetProjectByID(ctx, projectID)
if err == nil {
// to reduce load the content from database again, we just set the owner/repo here
if project.Type == project_model.TypeOrganization {
project.Owner = ctx.Repo.Owner
} else {
project.Repo = ctx.Repo.Repository
}
ctx.JSONRedirect(project.Link(ctx))
return
}
}
ctx.JSONRedirect(issue.Link())
}
Loading