diff options
author | Unknown <joe2010xtmf@163.com> | 2014-04-07 01:55:22 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-04-07 01:55:22 -0400 |
commit | 8c9a0494ecb477a641c07be68a9c0cb8fa661d29 (patch) | |
tree | 2dff6d6617e87564ada7630c0942939fd8869563 /routers | |
parent | e2fe2209057b90e6c78a84b7c66c3395cf100e30 (diff) | |
download | gitea-8c9a0494ecb477a641c07be68a9c0cb8fa661d29.tar.gz gitea-8c9a0494ecb477a641c07be68a9c0cb8fa661d29.zip |
Add @ # commit link detect on all markdown render
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/miscellaneous.go | 2 | ||||
-rw-r--r-- | routers/repo/issue.go | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/routers/api/v1/miscellaneous.go b/routers/api/v1/miscellaneous.go index 0ff1eb04a0..babdfce9b2 100644 --- a/routers/api/v1/miscellaneous.go +++ b/routers/api/v1/miscellaneous.go @@ -13,6 +13,6 @@ func Markdown(ctx *middleware.Context) { content := ctx.Query("content") ctx.Render.JSON(200, map[string]interface{}{ "ok": true, - "content": string(base.RenderMarkdown([]byte(content), "")), + "content": string(base.RenderMarkdown([]byte(content), ctx.Query("repoLink"))), }) } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index be92542641..38522e0c70 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -147,7 +147,7 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) { return } issue.Poster = u - issue.RenderedContent = string(base.RenderMarkdown([]byte(issue.Content), "")) + issue.RenderedContent = string(base.RenderMarkdown([]byte(issue.Content), ctx.Repo.RepoLink)) // Get comments. comments, err := models.GetIssueComments(issue.Id) @@ -164,7 +164,7 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) { return } comments[i].Poster = u - comments[i].Content = string(base.RenderMarkdown([]byte(comments[i].Content), "")) + comments[i].Content = string(base.RenderMarkdown([]byte(comments[i].Content), ctx.Repo.RepoLink)) } ctx.Data["Title"] = issue.Name @@ -193,7 +193,7 @@ func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat return } - if ctx.User.Id != issue.PosterId { + if ctx.User.Id != issue.PosterId && !ctx.Repo.IsOwner { ctx.Handle(404, "issue.UpdateIssue", nil) return } @@ -211,7 +211,7 @@ func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat ctx.JSON(200, map[string]interface{}{ "ok": true, "title": issue.Name, - "content": string(base.RenderMarkdown([]byte(issue.Content), "")), + "content": string(base.RenderMarkdown([]byte(issue.Content), ctx.Repo.RepoLink)), }) } |