fix: address verified review findings (admin-webhooks-keys-1)

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-18 17:42:51 +02:00
1 parent 0910cf307a
commit b69019fd74
13 files changed
+268 -31

No files matched your search

+5 -1
View File
@@ -61,6 +61,7 @@ const (
ReasonNotDone = "not done" // the run has not finished yet
ReasonKeyInUse = "key in use" // the SSH key is registered already
ReasonOwnsRepos = "owns repositories" // the user still owns repositories
ReasonOwnsOther = "owns other" // the user is still in organizations or owns packages
)
// ConflictError reports a request the current state of a resource refuses, such as closing a
@@ -105,6 +106,8 @@ func (e *ConflictError) Error() string {
text = "this SSH key is already registered"
case ReasonOwnsRepos:
text = cmp.Or(subject, "the user") + " still owns repositories"
case ReasonOwnsOther:
text = cmp.Or(subject, "the user") + " is still a member of organizations or owns packages"
default:
text = e.Err.Error()
}
@@ -153,7 +156,8 @@ var refusals = []struct {
{ReasonNotDone, []int{http.StatusBadRequest}, []string{"not done"}},
{ReasonKeyInUse, nil, []string{"key content has been used"}},
{ReasonOwnsRepos, nil, []string{"ownership of repositories"}},
{ReasonExists, []int{http.StatusBadRequest, http.StatusConflict, http.StatusUnprocessableEntity}, []string{"already exist", "release is has no tag"}},
{ReasonOwnsOther, nil, []string{"membership of organizations", "ownership of packages"}},
{ReasonExists, []int{http.StatusBadRequest, http.StatusConflict, http.StatusUnprocessableEntity}, []string{"already exist", "release is has no tag", "key title has been used"}},
}
var (