mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Use project's redirect url instead of composing url (#33058)
Fix #32992 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -396,8 +396,15 @@ 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 {
|
||||
ctx.JSONRedirect(project_model.ProjectLinkForOrg(ctx.Repo.Owner, project.ID))
|
||||
} else {
|
||||
ctx.JSONRedirect(project_model.ProjectLinkForRepo(repo, project.ID))
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
ctx.JSONRedirect(issue.Link())
|
||||
}
|
||||
|
Reference in New Issue
Block a user