forked from forgejo/forgejo
Add option to purge users (#18064)
Add the ability to purge users when deleting them. Close #15588 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
175705356c
commit
bffa303020
16 changed files with 221 additions and 51 deletions
|
@ -107,7 +107,7 @@ func getVersionByNameAndVersion(ctx context.Context, ownerID int64, packageType
|
|||
ExactMatch: true,
|
||||
Value: version,
|
||||
},
|
||||
IsInternal: isInternal,
|
||||
IsInternal: util.OptionalBoolOf(isInternal),
|
||||
Paginator: db.NewAbsoluteListOptions(0, 1),
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -171,7 +171,7 @@ type PackageSearchOptions struct {
|
|||
Name SearchValue // only results with the specific name are found
|
||||
Version SearchValue // only results with the specific version are found
|
||||
Properties map[string]string // only results are found which contain all listed version properties with the specific value
|
||||
IsInternal bool
|
||||
IsInternal util.OptionalBool
|
||||
HasFileWithName string // only results are found which are associated with a file with the specific name
|
||||
HasFiles util.OptionalBool // only results are found which have associated files
|
||||
Sort string
|
||||
|
@ -179,7 +179,10 @@ type PackageSearchOptions struct {
|
|||
}
|
||||
|
||||
func (opts *PackageSearchOptions) toConds() builder.Cond {
|
||||
var cond builder.Cond = builder.Eq{"package_version.is_internal": opts.IsInternal}
|
||||
cond := builder.NewCond()
|
||||
if !opts.IsInternal.IsNone() {
|
||||
cond = builder.Eq{"package_version.is_internal": opts.IsInternal.IsTrue()}
|
||||
}
|
||||
|
||||
if opts.OwnerID != 0 {
|
||||
cond = cond.And(builder.Eq{"package.owner_id": opts.OwnerID})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue