Skip to content

Move package settings to package instead of being tied to version#37026

Merged
wxiaoguang merged 20 commits into
go-gitea:mainfrom
TheFox0x7:package-settings-move
Apr 5, 2026
Merged

Move package settings to package instead of being tied to version#37026
wxiaoguang merged 20 commits into
go-gitea:mainfrom
TheFox0x7:package-settings-move

Conversation

@TheFox0x7
Copy link
Copy Markdown
Contributor

@TheFox0x7 TheFox0x7 commented Mar 29, 2026

Unties settings page from package version and adds button to delete the package version
Settings page now allows for deletion of entire package and it's versions as opposed to a single version

Adds an API endpoint to delete the entire package with all versions from registry

fixes: #36904

Co-Authored-By: gemini-3-flash

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 29, 2026
@TheFox0x7
Copy link
Copy Markdown
Contributor Author

TheFox0x7 commented Mar 29, 2026

Originally made on top of TF state PR but I think this should go first so I don't have to bundle both into one and I can just merge this into terraform PR.
I still need to look at the context changes because first version it did avoided those so I doubt they are needed needed to avoid missing package descriptor for settings page

Comment thread services/packages/packages.go
@TheFox0x7 TheFox0x7 marked this pull request as ready for review March 29, 2026 11:30
@TheFox0x7 TheFox0x7 marked this pull request as draft March 29, 2026 18:59
Comment thread services/packages/packages.go
@TheFox0x7 TheFox0x7 marked this pull request as ready for review March 30, 2026 18:30
@TheFox0x7
Copy link
Copy Markdown
Contributor Author

UI changes:
image
image

Delete package button was added on package view and settings page now allows for removal of entire package "lineage" instead of a single version.

Note that notifications are not sent on this operation.

Comment thread routers/web/web.go Outdated
Copy link
Copy Markdown
Member

@silverwind silverwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some issues (comment written by Claude Opus 4.6):

Comment thread services/packages/packages.go Outdated
Comment thread routers/web/user/package.go
Comment thread models/packages/package_property.go
Comment thread routers/web/user/package.go
Comment thread services/packages/packages.go
Comment thread routers/web/web.go Outdated
@lunny
Copy link
Copy Markdown
Member

lunny commented Apr 3, 2026

package setting page returned 404

image

@lunny
Copy link
Copy Markdown
Member

lunny commented Apr 3, 2026

Why is it necessary to have two deletion buttons?

@TheFox0x7
Copy link
Copy Markdown
Contributor Author

You mean the one on the package version page and in settings?

They are functionally different. You navigate to the package version and can go either to the package wide settings or you could delete this specific version (like before on the settings page).
The one on the settings page is for deleting the entire package and all it's versions.

@lunny
Copy link
Copy Markdown
Member

lunny commented Apr 4, 2026

You mean the one on the package version page and in settings?

They are functionally different. You navigate to the package version and can go either to the package wide settings or you could delete this specific version (like before on the settings page). The one on the settings page is for deleting the entire package and all it's versions.

So that the button text should be different?

add guard for the entire package deletion

co-authored-by: gemini3-flash
wxiaoguang
wxiaoguang previously approved these changes Apr 5, 2026
Copy link
Copy Markdown
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't fully tested, overall looks good

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 5, 2026
@wxiaoguang wxiaoguang dismissed their stale review April 5, 2026 12:33

dismiss

@GiteaBot GiteaBot added lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 5, 2026
Comment thread services/packages/packages.go
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 5, 2026
@wxiaoguang wxiaoguang requested a review from Copilot April 5, 2026 13:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Gitea’s package UX and APIs to treat “settings” and deletion as package-level concerns (not version-bound), while still supporting version deletion where appropriate. It addresses the request to delete an entire package (all versions) in one action, which is particularly relevant for package types like Terraform state.

Changes:

  • Adds service/model support to delete an entire package and all its versions/files/properties in one operation.
  • Adds/adjusts API routes and Swagger docs to distinguish “delete package” vs “delete package version”.
  • Updates web UI routes/templates so package settings are package-scoped, and version pages offer a “delete version” modal.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/integration/packages_service_test.go Adds integration coverage for deleting an entire package and ensuring related properties/files/versions are removed.
tests/integration/api_packages_test.go Adds API integration coverage for deleting an entire package and deleting a single package version.
templates/swagger/v1_json.tmpl Documents new DELETE package endpoint and renames existing delete operation to “delete package version”.
templates/package/shared/view.tmpl Updates settings link to be package-scoped; adds UI modal to delete a specific version.
templates/package/settings.tmpl Makes settings page package-scoped and adds confirmation input for deleting a whole package.
templates/admin/packages/list.tmpl Adjusts admin delete modal copy to reflect version deletion semantics.
services/packages/packages.go Implements RemovePackage and refactors version deletion to bulk-delete version file properties/files.
services/packages/cleanup/cleanup.go Notes blob deletion handling for unreferenced blobs in cleanup job.
services/context/package.go Allows package assignment to resolve descriptors for package-level routes (without requiring version).
routers/web/web.go Moves package settings routes out of version scope; adds POST endpoint for version deletion.
routers/web/user/package.go Switches settings-page deletion to delete whole package; adds handler for version deletion.
routers/web/admin/packages.go Updates flash message key for admin version deletion success.
routers/api/v1/packages/package.go Adds DeletePackageVersion; changes DeletePackage to delete the whole package.
routers/api/v1/api.go Adds DELETE on /packages/{owner}/{type}/{name}; routes version deletion to DeletePackageVersion.
options/locale/locale_en-US.json Adds new strings for package delete confirmation and version delete messaging.
models/packages/package_version.go Adds DeleteVersionsByPackageID helper.
models/packages/package_property.go Adds bulk deletion helpers for properties by package/version.
models/packages/package_file.go Adds bulk deletion helpers for files by package/version.
models/packages/descriptor.go Adds package settings link helper and helper to load all descriptors for notifications.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/integration/packages_service_test.go
Comment thread routers/web/user/package.go Outdated
Comment thread routers/web/user/package.go
Comment thread templates/package/shared/view.tmpl Outdated
Comment thread services/packages/packages.go Outdated
Comment thread services/packages/cleanup/cleanup.go Outdated
Comment thread services/packages/packages.go Outdated
Comment thread services/packages/packages.go
@lunny
Copy link
Copy Markdown
Member

lunny commented Apr 5, 2026

If the version is the last version of that package, should the whole package be deleted as well? Otherwise, there is no page to delete the empty package.

@TheFox0x7
Copy link
Copy Markdown
Contributor Author

That's cleaned up by cron task and I don't consider it in scope of this change. I do plan to go through the packages to see if I can clean it up a bit and drop query loops but that's for a later date.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 5, 2026
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 5, 2026
@wxiaoguang wxiaoguang merged commit ca51b4f into go-gitea:main Apr 5, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Apr 5, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 5, 2026
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 7, 2026
* main:
  Repair duration display for bad stopped timestamps (go-gitea#37121)
  Add terraform state registry (go-gitea#36710)
  Add placeholder content for empty content page (go-gitea#37114)
  Improve control char rendering and escape button styling (go-gitea#37094)
  Add gpg signing for merge rebase and update by rebase (go-gitea#36701)
  Move package settings to package instead of being tied to version (go-gitea#37026)
  Merge some standalone Vite entries into index.js (go-gitea#37085)
  Update Nix flake (go-gitea#37110)
  [skip ci] Updated translations via Crowdin
  Fix the wrong push commits in the pull request when force push (go-gitea#36914)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add package settings in UI

6 participants