Fix PR/issue redirects when having external tracker (#9339)

* Make sure only issues are redirected to external tracker

* Ensure correct redirects for pulls after dependency or watch.

* NewIssuePost is always issues so no need to redirect with type.
This commit is contained in:
David Svantesson 2019-12-14 01:53:32 +01:00 committed by Antoine GIRARD
parent 81a52442a1
commit f46176a418
3 changed files with 16 additions and 16 deletions

View file

@ -5,7 +5,6 @@
package repo
import (
"fmt"
"net/http"
"code.gitea.io/gitea/models"
@ -31,7 +30,7 @@ func AddDependency(ctx *context.Context) {
}
// Redirect
defer ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issueIndex), http.StatusSeeOther)
defer ctx.Redirect(issue.HTMLURL(), http.StatusSeeOther)
// Dependency
dep, err := models.GetIssueByID(depID)
@ -85,7 +84,7 @@ func RemoveDependency(ctx *context.Context) {
}
// Redirect
ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issueIndex), http.StatusSeeOther)
ctx.Redirect(issue.HTMLURL(), http.StatusSeeOther)
// Dependency Type
depTypeStr := ctx.Req.PostForm.Get("dependencyType")