mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08: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:
		@@ -200,6 +200,7 @@ type FindReleasesOptions struct {
 | 
			
		||||
	IsPreRelease  util.OptionalBool
 | 
			
		||||
	IsDraft       util.OptionalBool
 | 
			
		||||
	TagNames      []string
 | 
			
		||||
	HasSha1       util.OptionalBool // useful to find draft releases which are created with existing tags
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (opts *FindReleasesOptions) toConds(repoID int64) builder.Cond {
 | 
			
		||||
@@ -221,6 +222,13 @@ func (opts *FindReleasesOptions) toConds(repoID int64) builder.Cond {
 | 
			
		||||
	if !opts.IsDraft.IsNone() {
 | 
			
		||||
		cond = cond.And(builder.Eq{"is_draft": opts.IsDraft.IsTrue()})
 | 
			
		||||
	}
 | 
			
		||||
	if !opts.HasSha1.IsNone() {
 | 
			
		||||
		if opts.HasSha1.IsTrue() {
 | 
			
		||||
			cond = cond.And(builder.Neq{"sha1": ""})
 | 
			
		||||
		} else {
 | 
			
		||||
			cond = cond.And(builder.Eq{"sha1": ""})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return cond
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user