File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,7 @@ type FindReleasesOptions struct {
200
200
IsPreRelease util.OptionalBool
201
201
IsDraft util.OptionalBool
202
202
TagNames []string
203
+ HasSha1 util.OptionalBool // useful to find draft releases which are created with existing tags
203
204
}
204
205
205
206
func (opts * FindReleasesOptions ) toConds (repoID int64 ) builder.Cond {
@@ -221,6 +222,13 @@ func (opts *FindReleasesOptions) toConds(repoID int64) builder.Cond {
221
222
if ! opts .IsDraft .IsNone () {
222
223
cond = cond .And (builder.Eq {"is_draft" : opts .IsDraft .IsTrue ()})
223
224
}
225
+ if ! opts .HasSha1 .IsNone () {
226
+ if opts .HasSha1 .IsTrue () {
227
+ cond = cond .And (builder.Neq {"sha1" : "" })
228
+ } else {
229
+ cond = cond .And (builder.Eq {"sha1" : "" })
230
+ }
231
+ }
224
232
return cond
225
233
}
226
234
Original file line number Diff line number Diff line change @@ -524,7 +524,9 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
524
524
}
525
525
526
526
ctx .Data ["NumTags" ], err = repo_model .GetReleaseCountByRepoID (ctx .Repo .Repository .ID , repo_model.FindReleasesOptions {
527
- IncludeTags : true ,
527
+ IncludeDrafts : true ,
528
+ IncludeTags : true ,
529
+ HasSha1 : util .OptionalBoolTrue , // only draft releases which are created with existing tags
528
530
})
529
531
if err != nil {
530
532
ctx .ServerError ("GetReleaseCountByRepoID" , err )
Original file line number Diff line number Diff line change @@ -118,9 +118,12 @@ func releasesOrTags(ctx *context.Context, isTagList bool) {
118
118
119
119
opts := repo_model.FindReleasesOptions {
120
120
ListOptions : listOptions ,
121
- IncludeDrafts : writeAccess && ! isTagList ,
121
+ IncludeDrafts : isTagList || writeAccess ,
122
122
IncludeTags : isTagList ,
123
123
}
124
+ if isTagList {
125
+ opts .HasSha1 = util .OptionalBoolTrue // only draft releases which are created with existing tags
126
+ }
124
127
125
128
releases , err := repo_model .GetReleasesByRepoID (ctx .Repo .Repository .ID , opts )
126
129
if err != nil {
You can’t perform that action at this time.
0 commit comments