Skip to content

Commit

Permalink
Use project's redirect url instead of composing url
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Dec 31, 2024
1 parent c09656e commit 1aacf76
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions routers/web/repo/issue_new.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,16 @@ 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 {
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())
}

0 comments on commit 1aacf76

Please sign in to comment.