Deleting the last page of assets in Package Registry UI actually deletes all assets
Summary
In the Package Registry Web UI (tested w/ Generic), individually selecting all assets on the last page secretly causes all elements in the registry to be selected. If they are deleted, this (permanently) deletes the entire registry
Steps to reproduce
- Generate more than one page of assets in a Generic package registry. The example project will do this when its pipeline is run.
- Go to the Deploy/Package Registry, navigate to the last page (via Next >), and individually select each asset on the page
- Click 'Delete Selected'
Example Project
https://gitlab.com/startlotus.dev/package-deletion-bug
What is the current bug behavior?
All assets in the registry are permanently deleted. Note that the confirm dialog indicates this is going to happen, but it's very easy to click through without reading and it's still highly unexpected behavior with permanent consequences.
What is the expected correct behavior?
All assets on the current page are permanently deleted
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Possible fixes
This check seems to use hasNextPage to determine whether there are multiple pages of assets, but that doesn't work for the last page. https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_files.vue#L268