refactor(api): convert bot accounts through the admin user edit endpoint (#39355)

Follow-up to https://github.com/go-gitea/gitea/pull/38966. Replaces the
unreleased `POST /admin/users/{username}/convert-type` endpoint with a
`type` field on `PATCH /admin/users/{username}`.
This commit is contained in:
silverwind
2026-09-18 17:11:56 +02:00
committed by GitHub
parent 3bec08f998
commit 85eaf5c71c
12 changed files with 57 additions and 203 deletions
+21 -72
View File
@@ -3707,25 +3707,6 @@
"type": "object",
"x-go-package": "gitea.dev/modules/structs"
},
"ConvertUserTypeOption": {
"description": "ConvertUserTypeOption options when converting a user between individual and bot",
"properties": {
"user_type": {
"description": "The target user type",
"enum": [
"User",
"Bot"
],
"type": "string",
"x-go-name": "UserType"
}
},
"required": [
"user_type"
],
"type": "object",
"x-go-package": "gitea.dev/modules/structs"
},
"CreateAccessTokenOption": {
"description": "CreateAccessTokenOption options when create access token",
"properties": {
@@ -6330,6 +6311,14 @@
"type": "integer",
"x-go-name": "SourceID"
},
"type": {
"allOf": [
{
"$ref": "#/components/schemas/UserTypeString"
}
],
"description": "The user type"
},
"visibility": {
"allOf": [
{
@@ -10742,15 +10731,12 @@
"x-go-name": "StarredRepos"
},
"type": {
"description": "the account type",
"enum": [
"User",
"Organization",
"Bot"
"allOf": [
{
"$ref": "#/components/schemas/UserTypeString"
}
],
"type": "string",
"x-go-enum-desc": "User UserTypeStringUser\nOrganization UserTypeStringOrganization\nBot UserTypeStringBot",
"x-go-name": "Type"
"description": "the user type"
},
"visibility": {
"allOf": [
@@ -10908,6 +10894,14 @@
"type": "object",
"x-go-package": "gitea.dev/modules/structs"
},
"UserTypeString": {
"enum": [
"User",
"Organization",
"Bot"
],
"type": "string"
},
"VisibilityString": {
"enum": [
"public",
@@ -12291,51 +12285,6 @@
]
}
},
"/admin/users/{username}/convert-type": {
"post": {
"operationId": "adminConvertUserType",
"parameters": [
{
"description": "username of the user to convert",
"in": "path",
"name": "username",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ConvertUserTypeOption"
}
}
},
"required": true,
"x-originalParamName": "body"
},
"responses": {
"204": {
"$ref": "#/components/responses/empty"
},
"400": {
"$ref": "#/components/responses/error"
},
"403": {
"$ref": "#/components/responses/forbidden"
},
"404": {
"$ref": "#/components/responses/notFound"
}
},
"summary": "Convert an account between the user and bot types",
"tags": [
"admin"
]
}
},
"/admin/users/{username}/keys": {
"post": {
"operationId": "adminCreatePublicKey",
+12 -66
View File
@@ -1144,52 +1144,6 @@
}
}
},
"/admin/users/{username}/convert-type": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Convert an account between the user and bot types",
"operationId": "adminConvertUserType",
"parameters": [
{
"type": "string",
"description": "username of the user to convert",
"name": "username",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/ConvertUserTypeOption"
}
}
],
"responses": {
"204": {
"$ref": "#/responses/empty"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/admin/users/{username}/keys": {
"post": {
"consumes": [
@@ -26790,25 +26744,6 @@
},
"x-go-package": "gitea.dev/modules/structs"
},
"ConvertUserTypeOption": {
"description": "ConvertUserTypeOption options when converting a user between individual and bot",
"type": "object",
"required": [
"user_type"
],
"properties": {
"user_type": {
"description": "The target user type",
"type": "string",
"enum": [
"User",
"Bot"
],
"x-go-name": "UserType"
}
},
"x-go-package": "gitea.dev/modules/structs"
},
"CreateAccessTokenOption": {
"description": "CreateAccessTokenOption options when create access token",
"type": "object",
@@ -29457,6 +29392,17 @@
"format": "int64",
"x-go-name": "SourceID"
},
"type": {
"description": "The user type",
"type": "string",
"enum": [
"User",
"Organization",
"Bot"
],
"x-go-enum-desc": "User UserTypeStringUser\nOrganization UserTypeStringOrganization\nBot UserTypeStringBot",
"x-go-name": "Type"
},
"visibility": {
"description": "User visibility level: public, limited, or private",
"type": "string",
@@ -33820,7 +33766,7 @@
"x-go-name": "StarredRepos"
},
"type": {
"description": "the account type",
"description": "the user type",
"type": "string",
"enum": [
"User",