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:
parent
af849ac009
commit
a08b484549
4 changed files with 24 additions and 8 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue