diff options
Diffstat (limited to 'routers/repo/release.go')
-rw-r--r-- | routers/repo/release.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/routers/repo/release.go b/routers/repo/release.go index 6b0b92743d..b7730e4ee2 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -99,7 +99,7 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { Page: ctx.QueryInt("page"), PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")), }, - IncludeDrafts: writeAccess, + IncludeDrafts: writeAccess && !isTagList, IncludeTags: isTagList, } @@ -141,10 +141,7 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { } cacheUsers[r.PublisherID] = r.Publisher } - if err := calReleaseNumCommitsBehind(ctx.Repo, r, countCache); err != nil { - ctx.ServerError("calReleaseNumCommitsBehind", err) - return - } + r.Note, err = markdown.RenderString(&markup.RenderContext{ URLPrefix: ctx.Repo.RepoLink, Metas: ctx.Repo.Repository.ComposeMetas(), @@ -153,6 +150,15 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { ctx.ServerError("RenderString", err) return } + + if r.IsDraft { + continue + } + + if err := calReleaseNumCommitsBehind(ctx.Repo, r, countCache); err != nil { + ctx.ServerError("calReleaseNumCommitsBehind", err) + return + } } ctx.Data["Releases"] = releases @@ -198,9 +204,11 @@ func SingleRelease(ctx *context.Context) { return } } - if err := calReleaseNumCommitsBehind(ctx.Repo, release, make(map[string]int64)); err != nil { - ctx.ServerError("calReleaseNumCommitsBehind", err) - return + if !release.IsDraft { + if err := calReleaseNumCommitsBehind(ctx.Repo, release, make(map[string]int64)); err != nil { + ctx.ServerError("calReleaseNumCommitsBehind", err) + return + } } release.Note, err = markdown.RenderString(&markup.RenderContext{ URLPrefix: ctx.Repo.RepoLink, |