diff --git a/routers/web/user/package.go b/routers/web/user/package.go index 81a26da827..20141914b6 100644 --- a/routers/web/user/package.go +++ b/routers/web/user/package.go @@ -420,7 +420,13 @@ func PackageSettingsPost(ctx *context.Context) { ctx.Flash.Success(ctx.Tr("packages.settings.delete.success")) } - ctx.Redirect(ctx.Package.Owner.HomeLink() + "/-/packages") + redirectURL := ctx.Package.Owner.HomeLink() + "/-/packages" + // redirect to the package if there are still versions available + if has, _ := packages_model.ExistVersion(ctx, &packages_model.PackageSearchOptions{PackageID: ctx.Package.Descriptor.Package.ID}); has { + redirectURL = ctx.Package.Descriptor.PackageWebLink() + } + + ctx.Redirect(redirectURL) return } } diff --git a/templates/package/view.tmpl b/templates/package/view.tmpl index 1e7d13285e..6064db1b4c 100644 --- a/templates/package/view.tmpl +++ b/templates/package/view.tmpl @@ -84,19 +84,17 @@ {{end}} {{end}} - {{if .LatestVersions}} -
- {{.locale.Tr "packages.versions"}} ({{.TotalVersionCount}}) - {{.locale.Tr "packages.versions.view_all"}} -