1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Tag list should include draft releases with existing tags (#21263)

Before, a tag for a draft release disappeared in the tag list, fix #21262.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Jason Song
2022-10-03 20:05:53 +08:00
committed by GitHub
parent af849ac009
commit a08b484549
4 changed files with 24 additions and 8 deletions

View File

@@ -117,9 +117,17 @@ func releasesOrTags(ctx *context.Context, isTagList bool) {
ctx.Data["CanCreateRelease"] = writeAccess && !ctx.Repo.Repository.IsArchived
opts := repo_model.FindReleasesOptions{
ListOptions: listOptions,
IncludeDrafts: writeAccess && !isTagList,
IncludeTags: isTagList,
ListOptions: listOptions,
}
if isTagList {
// for the tags list page, show all releases with real tags (having real commit-id),
// the drafts should also be included because a real tag might be used as a draft.
opts.IncludeDrafts = true
opts.IncludeTags = true
opts.HasSha1 = util.OptionalBoolTrue
} else {
// only show draft releases for users who can write, read-only users shouldn't see draft releases.
opts.IncludeDrafts = writeAccess
}
releases, err := repo_model.GetReleasesByRepoID(ctx.Repo.Repository.ID, opts)