Skip to content

Commit d5d06b0

Browse files
committed
NumReleases include drafts if CanWrite releases
1 parent d1e066f commit d5d06b0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/context/repo.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,10 @@ func RepoAssignment(ctx *Context) context.CancelFunc {
544544
ctx.ServerError("GetReleaseCountByRepoID", err)
545545
return nil
546546
}
547-
ctx.Data["NumReleases"], err = repo_model.GetReleaseCountByRepoID(ctx, ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{})
547+
ctx.Data["NumReleases"], err = repo_model.GetReleaseCountByRepoID(ctx, ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{
548+
// only show draft releases for users who can write, read-only users shouldn't see draft releases.
549+
IncludeDrafts: ctx.Repo.CanWrite(unit_model.TypeReleases),
550+
})
548551
if err != nil {
549552
ctx.ServerError("GetReleaseCountByRepoID", err)
550553
return nil

0 commit comments

Comments
 (0)