mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
Use project's redirect url instead of composing url (#33058)
Fix #32992 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 20c7fba60157067252af49da41b6f8929a5ae31a) Conflicts: routers/web/repo/issue_new.go the function is at routers/web/repo/issue.go in Forgejo
This commit is contained in:
parent
15ff226a5b
commit
81f30218cf
4 changed files with 26 additions and 11 deletions
|
@ -1291,10 +1291,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 {
|
||||
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())
|
||||
}
|
||||
|
||||
// roleDescriptor returns the role descriptor for a comment in/with the given repo, poster and issue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue