[feature] Allow editing domain blocks/allows, fix comment import (#3967)

* start implementing editing of existing domain permissions

* [feature] Allow editing domain blocks/allows, fix comment import

* [bugfix] Use "comment" via /api/v1/instance

* fix the stuff
This commit is contained in:
tobi
2025-04-04 18:29:22 +02:00
committed by GitHub
parent db4b857159
commit b184432331
32 changed files with 1021 additions and 313 deletions

View File

@ -113,6 +113,27 @@ nothanks.com,suspend,false,false,,false
JSON lists use content type `application/json`.
```json
[
{
"domain": "bumfaces.net",
"suspended_at": "2020-05-13T13:29:12.000Z",
"comment": "big jerks"
},
{
"domain": "peepee.poopoo",
"suspended_at": "2020-05-13T13:29:12.000Z",
"comment": "harassment"
},
{
"domain": "nothanks.com",
"suspended_at": "2020-05-13T13:29:12.000Z"
}
]
```
As an alternative to `"comment"`, `"public_comment"` will also work:
```json
[
{

View File

@ -1099,13 +1099,22 @@ definitions:
domain:
description: Domain represents a remote domain
properties:
comment:
description: |-
If the domain is blocked, what's the publicly-stated reason for the block.
Alternative to `public_comment` to be used when serializing/deserializing via /api/v1/instance.
example: they smell
type: string
x-go-name: Comment
domain:
description: The hostname of the domain.
example: example.org
type: string
x-go-name: Domain
public_comment:
description: If the domain is blocked, what's the publicly-stated reason for the block.
description: |-
If the domain is blocked, what's the publicly-stated reason for the block.
Alternative to `comment` to be used when serializing/deserializing NOT via /api/v1/instance.
example: they smell
type: string
x-go-name: PublicComment
@ -1124,6 +1133,13 @@ definitions:
x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model
domainPermission:
properties:
comment:
description: |-
If the domain is blocked, what's the publicly-stated reason for the block.
Alternative to `public_comment` to be used when serializing/deserializing via /api/v1/instance.
example: they smell
type: string
x-go-name: Comment
created_at:
description: Time at which the permission entry was created (ISO 8601 Datetime).
example: "2021-07-30T09:20:25+00:00"
@ -1162,7 +1178,9 @@ definitions:
type: string
x-go-name: PrivateComment
public_comment:
description: If the domain is blocked, what's the publicly-stated reason for the block.
description: |-
If the domain is blocked, what's the publicly-stated reason for the block.
Alternative to `comment` to be used when serializing/deserializing NOT via /api/v1/instance.
example: they smell
type: string
x-go-name: PublicComment
@ -5823,6 +5841,53 @@ paths:
summary: View domain allow with the given ID.
tags:
- admin
put:
consumes:
- multipart/form-data
operationId: domainAllowUpdate
parameters:
- description: The id of the domain allow.
in: path
name: id
required: true
type: string
- description: Obfuscate the name of the domain when serving it publicly. Eg., `example.org` becomes something like `ex***e.org`.
in: formData
name: obfuscate
type: boolean
- description: Public comment about this domain allow. This will be displayed alongside the domain allow if you choose to share allows.
in: formData
name: public_comment
type: string
- description: Private comment about this domain allow. Will only be shown to other admins, so this is a useful way of internally keeping track of why a certain domain ended up allowed.
in: formData
name: private_comment
type: string
produces:
- application/json
responses:
"200":
description: The updated domain allow.
schema:
$ref: '#/definitions/domainPermission'
"400":
description: bad request
"401":
description: unauthorized
"403":
description: forbidden
"404":
description: not found
"406":
description: not acceptable
"500":
description: internal server error
security:
- OAuth2 Bearer:
- admin:write:domain_allows
summary: Update a single domain allow.
tags:
- admin
/api/v1/admin/domain_blocks:
get:
operationId: domainBlocksGet
@ -5990,6 +6055,53 @@ paths:
summary: View domain block with the given ID.
tags:
- admin
put:
consumes:
- multipart/form-data
operationId: domainBlockUpdate
parameters:
- description: The id of the domain block.
in: path
name: id
required: true
type: string
- description: Obfuscate the name of the domain when serving it publicly. Eg., `example.org` becomes something like `ex***e.org`.
in: formData
name: obfuscate
type: boolean
- description: Public comment about this domain block. This will be displayed alongside the domain block if you choose to share blocks.
in: formData
name: public_comment
type: string
- description: Private comment about this domain block. Will only be shown to other admins, so this is a useful way of internally keeping track of why a certain domain ended up blocked.
in: formData
name: private_comment
type: string
produces:
- application/json
responses:
"200":
description: The updated domain block.
schema:
$ref: '#/definitions/domainPermission'
"400":
description: bad request
"401":
description: unauthorized
"403":
description: forbidden
"404":
description: not found
"406":
description: not acceptable
"500":
description: internal server error
security:
- OAuth2 Bearer:
- admin:write:domain_blocks
summary: Update a single domain block.
tags:
- admin
/api/v1/admin/domain_keys_expire:
post:
consumes: