summaryrefslogtreecommitdiffstats
path: root/routers/repo/release.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/release.go')
-rw-r--r--routers/repo/release.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/routers/repo/release.go b/routers/repo/release.go
index 1b2c630a56..d9cc967801 100644
--- a/routers/repo/release.go
+++ b/routers/repo/release.go
@@ -65,13 +65,17 @@ func Releases(ctx *context.Context) {
limit = 10
}
- releases, err := models.GetReleasesByRepoID(ctx.Repo.Repository.ID, page, limit)
+ opts := models.FindReleasesOptions{
+ IncludeDrafts: ctx.Repo.IsWriter(),
+ }
+
+ releases, err := models.GetReleasesByRepoID(ctx.Repo.Repository.ID, opts, page, limit)
if err != nil {
ctx.Handle(500, "GetReleasesByRepoID", err)
return
}
- count, err := models.GetReleaseCountByRepoID(ctx.Repo.Repository.ID, ctx.Repo.IsOwner())
+ count, err := models.GetReleaseCountByRepoID(ctx.Repo.Repository.ID, opts)
if err != nil {
ctx.Handle(500, "GetReleaseCountByRepoID", err)
return
@@ -91,11 +95,7 @@ func Releases(ctx *context.Context) {
}
var ok bool
- releasesToDisplay := make([]*models.Release, 0, len(releases))
for _, r := range releases {
- if r.IsDraft && !ctx.Repo.IsOwner() {
- continue
- }
if r.Publisher, ok = cacheUsers[r.PublisherID]; !ok {
r.Publisher, err = models.GetUserByID(r.PublisherID)
if err != nil {
@@ -113,12 +113,11 @@ func Releases(ctx *context.Context) {
return
}
r.Note = markdown.RenderString(r.Note, ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())
- releasesToDisplay = append(releasesToDisplay, r)
}
pager := paginater.New(int(count), limit, page, 5)
ctx.Data["Page"] = pager
- ctx.Data["Releases"] = releasesToDisplay
+ ctx.Data["Releases"] = releases
ctx.HTML(200, tplReleases)
}