|
|
@@ -607,17 +607,20 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu |
|
|
|
|
|
|
|
// ViewIssue render issue view page |
|
|
|
func ViewIssue(ctx *context.Context) { |
|
|
|
extIssueUnit, err := ctx.Repo.Repository.GetUnit(models.UnitTypeExternalTracker) |
|
|
|
if err == nil && extIssueUnit != nil { |
|
|
|
if extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == markup.IssueNameStyleNumeric || extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == "" { |
|
|
|
metas := ctx.Repo.Repository.ComposeMetas() |
|
|
|
metas["index"] = ctx.Params(":index") |
|
|
|
ctx.Redirect(com.Expand(extIssueUnit.ExternalTrackerConfig().ExternalTrackerFormat, metas)) |
|
|
|
if ctx.Params(":type") == "issues" { |
|
|
|
// If issue was requested we check if repo has external tracker and redirect |
|
|
|
extIssueUnit, err := ctx.Repo.Repository.GetUnit(models.UnitTypeExternalTracker) |
|
|
|
if err == nil && extIssueUnit != nil { |
|
|
|
if extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == markup.IssueNameStyleNumeric || extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == "" { |
|
|
|
metas := ctx.Repo.Repository.ComposeMetas() |
|
|
|
metas["index"] = ctx.Params(":index") |
|
|
|
ctx.Redirect(com.Expand(extIssueUnit.ExternalTrackerConfig().ExternalTrackerFormat, metas)) |
|
|
|
return |
|
|
|
} |
|
|
|
} else if err != nil && !models.IsErrUnitTypeNotExist(err) { |
|
|
|
ctx.ServerError("GetUnit", err) |
|
|
|
return |
|
|
|
} |
|
|
|
} else if err != nil && !models.IsErrUnitTypeNotExist(err) { |
|
|
|
ctx.ServerError("GetUnit", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) |
|
|
@@ -1255,7 +1258,7 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) { |
|
|
|
|
|
|
|
if ctx.HasError() { |
|
|
|
ctx.Flash.Error(ctx.Data["ErrorMsg"].(string)) |
|
|
|
ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issue.Index)) |
|
|
|
ctx.Redirect(issue.HTMLURL()) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|